| 
                                                        @@ -122,7 +122,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    122
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    122
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    123
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    123
                                                                                                                                                                                                 | 
                                                             			if (!empty($perm)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    124
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    124
                                                                                                                                                                                                 | 
                                                             				$tmp = explode(':', $typeofdata); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    125
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    125
                                                                                                                                                                                                 | 
                                                            +				$ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    126
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    126
                                                                                                                                                                                                 | 
                                                             				if ($fieldrequired) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    127
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    127
                                                                                                                                                                                                 | 
                                                             					$ret .= '<span class="fieldrequired">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    128
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    128
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -134,7 +134,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    134
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    134
                                                                                                                                                                                                 | 
                                                             				if ($fieldrequired) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    135
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    135
                                                                                                                                                                                                 | 
                                                             					$ret .= '</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    136
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    136
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    137
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= '</div>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    137
                                                                                                                                                                                                 | 
                                                            +				$ret .= '</div>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    138
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    138
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    139
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    139
                                                                                                                                                                                                 | 
                                                             				if ($fieldrequired) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    140
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    140
                                                                                                                                                                                                 | 
                                                             					$ret .= '<span class="fieldrequired">';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -172,8 +172,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    172
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    172
                                                                                                                                                                                                 | 
                                                             			if (empty($notabletag) && $perm) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    173
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    173
                                                                                                                                                                                                 | 
                                                             				$ret .= '<td class="right">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    174
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    174
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    175
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    176
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$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>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    175
                                                                                                                                                                                                 | 
                                                            +			if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    176
                                                                                                                                                                                                 | 
                                                            +				$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
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    177
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    178
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    178
                                                                                                                                                                                                 | 
                                                             			if (!empty($notabletag) && $notabletag == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    179
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    179
                                                                                                                                                                                                 | 
                                                             				if ($text) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -240,7 +240,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    240
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    240
                                                                                                                                                                                                 | 
                                                             			} elseif ($reg[1] == 'int') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    241
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    241
                                                                                                                                                                                                 | 
                                                             				$typeofdata = 'numeric';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    242
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    242
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    243
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				return 'ErrorBadParameter ' . $typeofdata;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    243
                                                                                                                                                                                                 | 
                                                            +				return 'ErrorBadParameter '.$typeofdata;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    244
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    244
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    245
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    245
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    246
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    246
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -251,13 +251,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    251
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    251
                                                                                                                                                                                                 | 
                                                             			if ($editaction == '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    252
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    252
                                                                                                                                                                                                 | 
                                                             				$editaction = GETPOST('action', 'aZ09'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    253
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    253
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    254
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$editmode = ($editaction == 'edit' . $htmlname);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    254
                                                                                                                                                                                                 | 
                                                            +			$editmode = ($editaction == 'edit'.$htmlname);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    255
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    255
                                                                                                                                                                                                 | 
                                                             			if ($editmode) {	// edit mode | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    256
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    256
                                                                                                                                                                                                 | 
                                                             				$ret .= "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    257
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    258
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    259
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    260
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    257
                                                                                                                                                                                                 | 
                                                            +				$ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    258
                                                                                                                                                                                                 | 
                                                            +				$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    259
                                                                                                                                                                                                 | 
                                                            +				$ret .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    260
                                                                                                                                                                                                 | 
                                                            +				$ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    261
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    261
                                                                                                                                                                                                 | 
                                                             				if (empty($notabletag)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    262
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    262
                                                                                                                                                                                                 | 
                                                             					$ret .= '<table class="nobordernopadding centpercent">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    263
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    263
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -266,28 +266,28 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    266
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    266
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    267
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    267
                                                                                                                                                                                                 | 
                                                             				if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    268
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    268
                                                                                                                                                                                                 | 
                                                             					$tmp = explode(':', $typeofdata); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    269
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    269
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    270
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    270
                                                                                                                                                                                                 | 
                                                             				} elseif (preg_match('/^(integer)/', $typeofdata)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    271
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    271
                                                                                                                                                                                                 | 
                                                             					$tmp = explode(':', $typeofdata); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    272
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    272
                                                                                                                                                                                                 | 
                                                             					$valuetoshow = price2num($editvalue ? $editvalue : $value, 0);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    273
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    273
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    274
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    274
                                                                                                                                                                                                 | 
                                                             				} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    275
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    275
                                                                                                                                                                                                 | 
                                                             					$tmp = explode(':', $typeofdata); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    276
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    276
                                                                                                                                                                                                 | 
                                                             					$valuetoshow = price2num($editvalue ? $editvalue : $value);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    277
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    277
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    278
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    278
                                                                                                                                                                                                 | 
                                                             				} elseif (preg_match('/^(checkbox)/', $typeofdata)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    279
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    279
                                                                                                                                                                                                 | 
                                                             					$tmp = explode(':', $typeofdata); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    280
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    280
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    281
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    281
                                                                                                                                                                                                 | 
                                                             				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {    // if wysiwyg is enabled $typeofdata = 'ckeditor' | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    282
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    282
                                                                                                                                                                                                 | 
                                                             					$tmp = explode(':', $typeofdata); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    283
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    283
                                                                                                                                                                                                 | 
                                                             					$cols = (empty($tmp[2]) ? '' : $tmp[2]);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    284
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    284
                                                                                                                                                                                                 | 
                                                             					$morealt = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    285
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    285
                                                                                                                                                                                                 | 
                                                             					if (preg_match('/%/', $cols)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    286
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$morealt = ' style="width: ' . $cols . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    286
                                                                                                                                                                                                 | 
                                                            +						$morealt = ' style="width: '.$cols.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    287
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    287
                                                                                                                                                                                                 | 
                                                             						$cols = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    288
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    288
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    289
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    289
                                                                                                                                                                                                 | 
                                                             					$valuetoshow = ($editvalue ? $editvalue : $value);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    290
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    290
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    291
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    291
                                                                                                                                                                                                 | 
                                                             					// textarea convert automatically entities chars into simple chars.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    292
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    292
                                                                                                                                                                                                 | 
                                                             					// 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. | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    293
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    293
                                                                                                                                                                                                 | 
                                                             					$valuetoshow = str_replace('&', '&', $valuetoshow); | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -297,12 +297,12 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    297
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    297
                                                                                                                                                                                                 | 
                                                             					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    298
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    298
                                                                                                                                                                                                 | 
                                                             					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    299
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    299
                                                                                                                                                                                                 | 
                                                             					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    300
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    300
                                                                                                                                                                                                 | 
                                                            +					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    301
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    301
                                                                                                                                                                                                 | 
                                                             				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    302
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    302
                                                                                                                                                                                                 | 
                                                             					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    303
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    303
                                                                                                                                                                                                 | 
                                                             					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    304
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    304
                                                                                                                                                                                                 | 
                                                             					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    305
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    305
                                                                                                                                                                                                 | 
                                                            +					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    306
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    306
                                                                                                                                                                                                 | 
                                                             				} elseif (preg_match('/^select;/', $typeofdata)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    307
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    307
                                                                                                                                                                                                 | 
                                                             					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    308
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    308
                                                                                                                                                                                                 | 
                                                             					$arraylist = array();  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -316,7 +316,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    316
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    316
                                                                                                                                                                                                 | 
                                                             					// TODO Not yet implemented. See code for extrafields  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    317
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    317
                                                                                                                                                                                                 | 
                                                             				} elseif (preg_match('/^ckeditor/', $typeofdata)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    318
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    318
                                                                                                                                                                                                 | 
                                                             					$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    319
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    319
                                                                                                                                                                                                 | 
                                                            +					require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    320
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    320
                                                                                                                                                                                                 | 
                                                             					$doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? '100' : $tmp[3]), (empty($tmp[1]) ? 'dolibarr_notes' : $tmp[1]), 'In', (empty($tmp[5]) ? 0 : $tmp[5]), (isset($tmp[8]) ? ($tmp[8] ? true : false) : true), true, (empty($tmp[6]) ? '20' : $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7]));  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    321
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    321
                                                                                                                                                                                                 | 
                                                             					$ret .= $doleditor->Create(1);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    322
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    322
                                                                                                                                                                                                 | 
                                                             				} elseif ($typeofdata == 'asis') { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -331,19 +331,19 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    331
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    331
                                                                                                                                                                                                 | 
                                                             					$ret .= '<td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    332
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    332
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    333
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    333
                                                                                                                                                                                                 | 
                                                             				//else $ret.='<div class="clearboth"></div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    334
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= '<input type="submit" class="smallpaddingimp button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    334
                                                                                                                                                                                                 | 
                                                            +				$ret .= '<input type="submit" class="smallpaddingimp button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    335
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    335
                                                                                                                                                                                                 | 
                                                             				if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    336
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<br>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    336
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<br>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    337
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    337
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    338
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    338
                                                                                                                                                                                                 | 
                                                            +				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    339
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    339
                                                                                                                                                                                                 | 
                                                             				if (empty($notabletag)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    340
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    340
                                                                                                                                                                                                 | 
                                                             					$ret .= '</td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    341
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    341
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    342
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    342
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    343
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    343
                                                                                                                                                                                                 | 
                                                             				if (empty($notabletag)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    344
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '</tr></table>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    344
                                                                                                                                                                                                 | 
                                                            +					$ret .= '</tr></table>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    345
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    345
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    346
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= '</form>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    346
                                                                                                                                                                                                 | 
                                                            +				$ret .= '</form>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    347
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    347
                                                                                                                                                                                                 | 
                                                             			} else {		// view mode | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    348
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    348
                                                                                                                                                                                                 | 
                                                             				if (preg_match('/^email/', $typeofdata)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    349
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    349
                                                                                                                                                                                                 | 
                                                             					$ret .= dol_print_email($value, 0, 0, 0, 0, 1);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -355,15 +355,15 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    355
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    355
                                                                                                                                                                                                 | 
                                                             					$ret .= ($value != '' ? price($value, 0, $langs, 0, -1, -1, $conf->currency) : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    356
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    356
                                                                                                                                                                                                 | 
                                                             				} elseif (preg_match('/^checkbox/', $typeofdata)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    357
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    357
                                                                                                                                                                                                 | 
                                                             					$tmp = explode(':', $typeofdata); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    358
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    358
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    359
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    359
                                                                                                                                                                                                 | 
                                                             				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    360
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    360
                                                                                                                                                                                                 | 
                                                             					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1));  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    361
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    361
                                                                                                                                                                                                 | 
                                                             				} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) {	// 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring' | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    362
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    362
                                                                                                                                                                                                 | 
                                                             					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value));  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    363
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    363
                                                                                                                                                                                                 | 
                                                             				} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    364
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    364
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    365
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    365
                                                                                                                                                                                                 | 
                                                             				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    366
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    366
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    367
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    367
                                                                                                                                                                                                 | 
                                                             				} elseif (preg_match('/^select;/', $typeofdata)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    368
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    368
                                                                                                                                                                                                 | 
                                                             					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    369
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    369
                                                                                                                                                                                                 | 
                                                             					$arraylist = array();  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -374,9 +374,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    374
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    374
                                                                                                                                                                                                 | 
                                                             					$ret .= $arraylist[$value];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    375
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    375
                                                                                                                                                                                                 | 
                                                             					if ($htmlname == 'fk_product_type') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    376
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    376
                                                                                                                                                                                                 | 
                                                             						if ($value == 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    377
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    377
                                                                                                                                                                                                 | 
                                                            +							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    378
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    378
                                                                                                                                                                                                 | 
                                                             						} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    379
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    379
                                                                                                                                                                                                 | 
                                                            +							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    380
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    380
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    381
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    381
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    382
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    382
                                                                                                                                                                                                 | 
                                                             				} elseif (preg_match('/^ckeditor/', $typeofdata)) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -384,7 +384,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    384
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    384
                                                                                                                                                                                                 | 
                                                             					if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    385
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    385
                                                                                                                                                                                                 | 
                                                             						$firstline = preg_replace('/<br>.*/', '', $tmpcontent); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    386
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    386
                                                                                                                                                                                                 | 
                                                             						$firstline = preg_replace('/[\n\r].*/', '', $firstline); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    387
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    387
                                                                                                                                                                                                 | 
                                                            +						$tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    388
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    388
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    389
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    389
                                                                                                                                                                                                 | 
                                                             					// We don't use dol_escape_htmltag to get the html formatting active, but this need we must also  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    390
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    390
                                                                                                                                                                                                 | 
                                                             					// clean data from some dangerous html  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -393,7 +393,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    393
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    393
                                                                                                                                                                                                 | 
                                                             					if (empty($moreoptions['valuealreadyhtmlescaped'])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    394
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    394
                                                                                                                                                                                                 | 
                                                             						$ret .= dol_escape_htmltag($value);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    395
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    395
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    396
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$ret .= $value;        // $value must be already html escaped.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    396
                                                                                                                                                                                                 | 
                                                            +						$ret .= $value; // $value must be already html escaped.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    397
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    397
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    398
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    398
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    399
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    399
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -431,7 +431,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    431
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    431
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    432
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    432
                                                                                                                                                                                                 | 
                                                             		if (is_array($arrayoflangcode) && count($arrayoflangcode)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    433
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    433
                                                                                                                                                                                                 | 
                                                             			if (!is_object($extralanguages)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    434
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    434
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    435
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    435
                                                                                                                                                                                                 | 
                                                             				$extralanguages = new ExtraLanguages($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    436
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    436
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    437
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    437
                                                                                                                                                                                                 | 
                                                             			$extralanguages->fetch_name_extralanguages('societe'); | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -440,17 +440,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    440
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    440
                                                                                                                                                                                                 | 
                                                             				return ''; // No extralang field to show  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    441
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    441
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    442
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    442
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    443
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$result .= '<!-- Widget for translation -->' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    444
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    443
                                                                                                                                                                                                 | 
                                                            +			$result .= '<!-- Widget for translation -->'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    444
                                                                                                                                                                                                 | 
                                                            +			$result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    445
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    445
                                                                                                                                                                                                 | 
                                                             			$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', false, 0, 0, '', 'fa-15 editfieldlang'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    446
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    446
                                                                                                                                                                                                 | 
                                                             			$result .= $s;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    447
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    447
                                                                                                                                                                                                 | 
                                                             			$result .= '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    448
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    448
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    449
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    449
                                                                                                                                                                                                 | 
                                                            +			$result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    450
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    450
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    451
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    451
                                                                                                                                                                                                 | 
                                                             			$resultforextrlang = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    452
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    452
                                                                                                                                                                                                 | 
                                                             			foreach ($arrayoflangcode as $langcode) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    453
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : ''; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    453
                                                                                                                                                                                                 | 
                                                            +				$valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : ''; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    454
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    454
                                                                                                                                                                                                 | 
                                                             				if (empty($valuetoshow)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    455
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    455
                                                                                                                                                                                                 | 
                                                             					$object->fetchValuesForExtraLanguages();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    456
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    456
                                                                                                                                                                                                 | 
                                                             					//var_dump($object->array_languages);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -462,17 +462,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    462
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    462
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    463
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    463
                                                                                                                                                                                                 | 
                                                             				// TODO Use the showInputField() method of ExtraLanguages object  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    464
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    464
                                                                                                                                                                                                 | 
                                                             				if ($typeofdata == 'textarea') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    465
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    465
                                                                                                                                                                                                 | 
                                                            +					$resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    466
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    466
                                                                                                                                                                                                 | 
                                                             					$resultforextrlang .= $valuetoshow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    467
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    467
                                                                                                                                                                                                 | 
                                                             					$resultforextrlang .= '</textarea>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    468
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    468
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    469
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    469
                                                                                                                                                                                                 | 
                                                            +					$resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    470
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    470
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    471
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    471
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    472
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    472
                                                                                                                                                                                                 | 
                                                             			$result .= $resultforextrlang;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    473
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    473
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    474
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    474
                                                                                                                                                                                                 | 
                                                             			$result .= '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    475
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    475
                                                                                                                                                                                                 | 
                                                            +			$result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    476
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    476
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    477
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    477
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    478
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    478
                                                                                                                                                                                                 | 
                                                             		return $result;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -535,7 +535,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    535
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    535
                                                                                                                                                                                                 | 
                                                             				if (!empty($tmp[2])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    536
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    536
                                                                                                                                                                                                 | 
                                                             					$savemethod = $tmp[2];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    537
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    537
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    538
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    538
                                                                                                                                                                                                 | 
                                                            +				$out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    539
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    539
                                                                                                                                                                                                 | 
                                                             			} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    540
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    540
                                                                                                                                                                                                 | 
                                                             				$tmp = explode(':', $inputType); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    541
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    541
                                                                                                                                                                                                 | 
                                                             				$inputType = $tmp[0];  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -546,7 +546,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    546
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    546
                                                                                                                                                                                                 | 
                                                             					$savemethod = $tmp[2];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    547
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    547
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    548
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    548
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    549
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    549
                                                                                                                                                                                                 | 
                                                            +				$out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    550
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    550
                                                                                                                                                                                                 | 
                                                             			} elseif (preg_match('/^(select|autocomplete)/', $inputType)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    551
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    551
                                                                                                                                                                                                 | 
                                                             				$tmp = explode(':', $inputType); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    552
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    552
                                                                                                                                                                                                 | 
                                                             				$inputType = $tmp[0];  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -577,40 +577,40 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    577
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    577
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    578
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    578
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    579
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    579
                                                                                                                                                                                                 | 
                                                             				if (isModEnabled('fckeditor')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    580
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    580
                                                                                                                                                                                                 | 
                                                            +					$out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    581
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    581
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    582
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    582
                                                                                                                                                                                                 | 
                                                             					$inputType = 'textarea';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    583
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    583
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    584
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    584
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    585
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    585
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    586
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    587
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    588
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    589
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    586
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    587
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    588
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    589
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    590
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    590
                                                                                                                                                                                                 | 
                                                             			if (!empty($savemethod)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    591
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    591
                                                                                                                                                                                                 | 
                                                            +				$out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    592
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    592
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    593
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    593
                                                                                                                                                                                                 | 
                                                             			if (!empty($ext_element)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    594
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    594
                                                                                                                                                                                                 | 
                                                            +				$out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    595
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    595
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    596
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    596
                                                                                                                                                                                                 | 
                                                             			if (!empty($custommsg)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    597
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    597
                                                                                                                                                                                                 | 
                                                             				if (is_array($custommsg)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    598
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    598
                                                                                                                                                                                                 | 
                                                             					if (!empty($custommsg['success'])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    599
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    599
                                                                                                                                                                                                 | 
                                                            +						$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    600
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    600
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    601
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    601
                                                                                                                                                                                                 | 
                                                             					if (!empty($custommsg['error'])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    602
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    602
                                                                                                                                                                                                 | 
                                                            +						$out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    603
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    603
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    604
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    604
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    605
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    605
                                                                                                                                                                                                 | 
                                                            +					$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    606
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    606
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    607
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    607
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    608
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    608
                                                                                                                                                                                                 | 
                                                             			if ($inputType == 'textarea') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    609
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    610
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    609
                                                                                                                                                                                                 | 
                                                            +				$out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    610
                                                                                                                                                                                                 | 
                                                            +				$out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    611
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    611
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    612
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    613
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    612
                                                                                                                                                                                                 | 
                                                            +			$out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    613
                                                                                                                                                                                                 | 
                                                            +			$out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    614
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    614
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    615
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    615
                                                                                                                                                                                                 | 
                                                             			$out = $value;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    616
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    616
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -639,12 +639,12 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    639
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    639
                                                                                                                                                                                                 | 
                                                             	public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    640
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    640
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    641
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    641
                                                                                                                                                                                                 | 
                                                             		if ($incbefore) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    642
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$text = $incbefore . $text;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    642
                                                                                                                                                                                                 | 
                                                            +			$text = $incbefore.$text;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    643
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    643
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    644
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    644
                                                                                                                                                                                                 | 
                                                             		if (!$htmltext) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    645
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    645
                                                                                                                                                                                                 | 
                                                             			return $text;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    646
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    646
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    647
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$direction = (int) $direction;    // For backward compatibility when $direction was set to '' instead of 0  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    647
                                                                                                                                                                                                 | 
                                                            +		$direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    648
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    648
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    649
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    649
                                                                                                                                                                                                 | 
                                                             		$tag = 'td';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    650
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    650
                                                                                                                                                                                                 | 
                                                             		if ($notabs == 2) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -658,11 +658,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    658
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    658
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    659
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    659
                                                                                                                                                                                                 | 
                                                             		$extrastyle = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    660
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    660
                                                                                                                                                                                                 | 
                                                             		if ($direction < 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    661
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    661
                                                                                                                                                                                                 | 
                                                            +			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    662
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    662
                                                                                                                                                                                                 | 
                                                             			$extrastyle = 'padding: 0px; padding-left: 3px;';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    663
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    663
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    664
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    664
                                                                                                                                                                                                 | 
                                                             		if ($direction > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    665
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    665
                                                                                                                                                                                                 | 
                                                            +			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    666
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    666
                                                                                                                                                                                                 | 
                                                             			$extrastyle = 'padding: 0px; padding-right: 3px;';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    667
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    667
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    668
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    668
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -675,53 +675,53 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    675
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    675
                                                                                                                                                                                                 | 
                                                             			$htmltext = str_replace('"', '"', $htmltext); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    676
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    676
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    677
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    677
                                                                                                                                                                                                 | 
                                                             			$classfortooltip = 'classfortooltiponclick';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    678
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    678
                                                                                                                                                                                                 | 
                                                            +			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    679
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    679
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    680
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    680
                                                                                                                                                                                                 | 
                                                             		if ($tooltipon == 2 || $tooltipon == 3) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    681
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    681
                                                                                                                                                                                                 | 
                                                            +			$paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    682
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    682
                                                                                                                                                                                                 | 
                                                             			if ($tooltiptrigger == '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    683
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    683
                                                                                                                                                                                                 | 
                                                            +				$paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    684
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    684
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    685
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    685
                                                                                                                                                                                                 | 
                                                            +				$paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    686
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    686
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    687
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    687
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    688
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    688
                                                                                                                                                                                                 | 
                                                            +			$paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    689
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    689
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    690
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    690
                                                                                                                                                                                                 | 
                                                             		if ($tooltipon == 1 || $tooltipon == 3) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    691
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    691
                                                                                                                                                                                                 | 
                                                            +			$paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    692
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    692
                                                                                                                                                                                                 | 
                                                             			if ($tooltiptrigger == '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    693
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    693
                                                                                                                                                                                                 | 
                                                            +				$paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    694
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    694
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    695
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    695
                                                                                                                                                                                                 | 
                                                            +				$paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    696
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    696
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    697
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    697
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    698
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    698
                                                                                                                                                                                                 | 
                                                            +			$paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    699
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    699
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    700
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    700
                                                                                                                                                                                                 | 
                                                             		if (empty($notabs)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    701
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    701
                                                                                                                                                                                                 | 
                                                             			$s .= '<table class="nobordernopadding"><tr style="height: auto;">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    702
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    702
                                                                                                                                                                                                 | 
                                                             		} elseif ($notabs == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    703
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    703
                                                                                                                                                                                                 | 
                                                            +			$s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    704
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    704
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    705
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    705
                                                                                                                                                                                                 | 
                                                             		// Define value if value is before  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    706
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    706
                                                                                                                                                                                                 | 
                                                             		if ($direction < 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    707
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$s .= '<' . $tag . $paramfortooltipimg;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    707
                                                                                                                                                                                                 | 
                                                            +			$s .= '<'.$tag.$paramfortooltipimg;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    708
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    708
                                                                                                                                                                                                 | 
                                                             			if ($tag == 'td') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    709
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    709
                                                                                                                                                                                                 | 
                                                             				$s .= ' class="valigntop" width="14"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    710
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    710
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    711
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    711
                                                                                                                                                                                                 | 
                                                            +			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    712
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    712
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    713
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    713
                                                                                                                                                                                                 | 
                                                             		// Use another method to help avoid having a space in value in order to use this value with jquery  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    714
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    714
                                                                                                                                                                                                 | 
                                                             		// Define label  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    715
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    715
                                                                                                                                                                                                 | 
                                                             		if ((string) $text != '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    716
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    716
                                                                                                                                                                                                 | 
                                                            +			$s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    717
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    717
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    718
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    718
                                                                                                                                                                                                 | 
                                                             		// Define value if value is after  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    719
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    719
                                                                                                                                                                                                 | 
                                                             		if ($direction > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    720
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$s .= '<' . $tag . $paramfortooltipimg;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    720
                                                                                                                                                                                                 | 
                                                            +			$s .= '<'.$tag.$paramfortooltipimg;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    721
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    721
                                                                                                                                                                                                 | 
                                                             			if ($tag == 'td') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    722
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    722
                                                                                                                                                                                                 | 
                                                             				$s .= ' class="valignmiddle" width="14"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    723
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    723
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    724
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    724
                                                                                                                                                                                                 | 
                                                            +			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    725
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    725
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    726
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    726
                                                                                                                                                                                                 | 
                                                             		if (empty($notabs)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    727
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    727
                                                                                                                                                                                                 | 
                                                             			$s .= '</tr></table>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -828,7 +828,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    828
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    828
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    829
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    829
                                                                                                                                                                                                 | 
                                                             		$disabled = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    830
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    830
                                                                                                                                                                                                 | 
                                                             		$ret = '<div class="centpercent center">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    831
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    831
                                                                                                                                                                                                 | 
                                                            +		$ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    832
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    832
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    833
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    833
                                                                                                                                                                                                 | 
                                                             		// 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.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    834
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    834
                                                                                                                                                                                                 | 
                                                             		$parameters = array();  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -839,10 +839,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    839
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    839
                                                                                                                                                                                                 | 
                                                             			return;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    840
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    840
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    841
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    841
                                                                                                                                                                                                 | 
                                                             		if (empty($reshook)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    842
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    842
                                                                                                                                                                                                 | 
                                                            +			$ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    843
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    843
                                                                                                                                                                                                 | 
                                                             			if (is_array($arrayofaction)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    844
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    844
                                                                                                                                                                                                 | 
                                                             				foreach ($arrayofaction as $code => $label) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    845
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    845
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    846
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    846
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    847
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    847
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    848
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    848
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -851,17 +851,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    851
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    851
                                                                                                                                                                                                 | 
                                                             		$ret .= '</select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    852
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    852
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    853
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    853
                                                                                                                                                                                                 | 
                                                             		if (empty($conf->dol_optimize_smallscreen)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    854
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= ajax_combobox('.' . $name . 'select'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    854
                                                                                                                                                                                                 | 
                                                            +			$ret .= ajax_combobox('.'.$name.'select'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    855
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    855
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    856
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    856
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    857
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    857
                                                                                                                                                                                                 | 
                                                             		// 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  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    858
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    858
                                                                                                                                                                                                 | 
                                                             		$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.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    859
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$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")) . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    859
                                                                                                                                                                                                 | 
                                                            +		$ret .= '<input type="submit" disabled name="confirmmassaction"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display: none"').' class="reposition button smallpaddingimp'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    860
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    860
                                                                                                                                                                                                 | 
                                                             		$ret .= '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    861
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    861
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    862
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    862
                                                                                                                                                                                                 | 
                                                             		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    863
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    863
                                                                                                                                                                                                 | 
                                                             			$ret .= '<!-- JS CODE TO ENABLE mass action select -->  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    864
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -    		<script nonce="' . getNonce() . '">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    864
                                                                                                                                                                                                 | 
                                                            +    		<script nonce="' . getNonce().'">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    865
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    865
                                                                                                                                                                                                 | 
                                                                                     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 */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    866
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    866
                                                                                                                                                                                                 | 
                                                                     		{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    867
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    867
                                                                                                                                                                                                 | 
                                                                     			atleastoneselected=0;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -872,11 +872,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    872
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    872
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    873
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    873
                                                                                                                                                                                                 | 
                                                             					console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    874
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    874
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    875
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -    	  			if (atleastoneselected || ' . $alwaysvisible . ')  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    875
                                                                                                                                                                                                 | 
                                                            +    	  			if (atleastoneselected || ' . $alwaysvisible.')  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    876
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    876
                                                                                                                                                                                                 | 
                                                                 	  			{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    877
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    877
                                                                                                                                                                                                 | 
                                                                                                 jQuery("."+name).show(); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    878
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . ' | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    879
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . ' | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    878
                                                                                                                                                                                                 | 
                                                            +        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').' | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    879
                                                                                                                                                                                                 | 
                                                            +        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').' | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    880
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    880
                                                                                                                                                                                                 | 
                                                                 	  			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    881
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    881
                                                                                                                                                                                                 | 
                                                                 	  			else  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    882
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    882
                                                                                                                                                                                                 | 
                                                                 	  			{ | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -886,11 +886,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    886
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    886
                                                                                                                                                                                                 | 
                                                                     		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    887
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    887
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    888
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    888
                                                                                                                                                                                                 | 
                                                                     	jQuery(document).ready(function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    889
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                    initCheckForSelect(0, "' . $name . '", "' . $cssclass . '");  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    890
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                    jQuery(".' . $cssclass . '").click(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    891
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                        initCheckForSelect(1, "' . $name . '", "' . $cssclass . '");  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    889
                                                                                                                                                                                                 | 
                                                            +                    initCheckForSelect(0, "' . $name.'", "'.$cssclass.'");  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    890
                                                                                                                                                                                                 | 
                                                            +                    jQuery(".' . $cssclass.'").click(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    891
                                                                                                                                                                                                 | 
                                                            +                        initCheckForSelect(1, "' . $name.'", "'.$cssclass.'");  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    892
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    892
                                                                                                                                                                                                 | 
                                                                                 });  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    893
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                        jQuery(".' . $name . 'select").change(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    893
                                                                                                                                                                                                 | 
                                                            +                        jQuery(".' . $name.'select").change(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    894
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    894
                                                                                                                                                                                                 | 
                                                                     			var massaction = $( this ).val();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    895
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    895
                                                                                                                                                                                                 | 
                                                                     			var urlform = $( this ).closest("form").attr("action").replace("#show_files",""); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    896
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    896
                                                                                                                                                                                                 | 
                                                                     			if (massaction == "builddoc")  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -898,18 +898,18 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    898
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    898
                                                                                                                                                                                                 | 
                                                                                     urlform = urlform + "#show_files";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    899
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    899
                                                                                                                                                                                                 | 
                                                                 	            }  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    900
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    900
                                                                                                                                                                                                 | 
                                                                     			$( this ).closest("form").attr("action", urlform); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    901
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                    console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    901
                                                                                                                                                                                                 | 
                                                            +                    console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    902
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    902
                                                                                                                                                                                                 | 
                                                                     	        /* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    903
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    903
                                                                                                                                                                                                 | 
                                                                     			if ($(this).val() != \'0\')  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    904
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    904
                                                                                                                                                                                                 | 
                                                                 	  			{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    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
                                                                                                                                                                                                 | 
                                                                 	  			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    909
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    909
                                                                                                                                                                                                 | 
                                                                 	  			else  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    910
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    910
                                                                                                                                                                                                 | 
                                                                 	  			{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    911
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', true); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    912
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -										jQuery(".' . $name . 'other").hide();	/* To disable any div open */ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    911
                                                                                                                                                                                                 | 
                                                            +                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', true); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    912
                                                                                                                                                                                                 | 
                                                            +										jQuery(".' . $name.'other").hide();	/* To disable any div open */ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    913
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    913
                                                                                                                                                                                                 | 
                                                                 	  			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    914
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    914
                                                                                                                                                                                                 | 
                                                                 	        });  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    915
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    915
                                                                                                                                                                                                 | 
                                                                     	});  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -952,14 +952,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    952
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    952
                                                                                                                                                                                                 | 
                                                             		$atleastonefavorite = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    953
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    953
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    954
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    954
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    955
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "c_country";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    955
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."c_country";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    956
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    956
                                                                                                                                                                                                 | 
                                                             		$sql .= " WHERE active > 0";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    957
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    957
                                                                                                                                                                                                 | 
                                                             		//$sql.= " ORDER BY code ASC";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    958
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    958
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    959
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::select_country", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    959
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::select_country", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    960
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    960
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    961
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    961
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    962
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    962
                                                                                                                                                                                                 | 
                                                            +			$out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    963
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    963
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($resql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    964
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    964
                                                                                                                                                                                                 | 
                                                             			$i = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    965
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    965
                                                                                                                                                                                                 | 
                                                             			if ($num) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -969,7 +969,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    969
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    969
                                                                                                                                                                                                 | 
                                                             					$countryArray[$i]['rowid'] = $obj->rowid;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    970
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    970
                                                                                                                                                                                                 | 
                                                             					$countryArray[$i]['code_iso'] = $obj->code_iso;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    971
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    971
                                                                                                                                                                                                 | 
                                                             					$countryArray[$i]['code_iso3'] = $obj->code_iso3;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    972
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$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
                                                                                                                                                                                                 | 
                                                            +					$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 : '')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    973
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    973
                                                                                                                                                                                                 | 
                                                             					$countryArray[$i]['favorite'] = $obj->favorite;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    974
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    974
                                                                                                                                                                                                 | 
                                                             					$countryArray[$i]['eec'] = $obj->eec;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    975
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    975
                                                                                                                                                                                                 | 
                                                             					$favorite[$i] = $obj->favorite;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -987,20 +987,20 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    987
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    987
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    988
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    988
                                                                                                                                                                                                 | 
                                                             				if ($showempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    989
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    989
                                                                                                                                                                                                 | 
                                                             					if (is_numeric($showempty)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    990
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '<option value=""> </option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    990
                                                                                                                                                                                                 | 
                                                            +						$out .= '<option value=""> </option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    991
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    991
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    992
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    992
                                                                                                                                                                                                 | 
                                                            +						$out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    993
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    993
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    994
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    994
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    995
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    995
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    996
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    996
                                                                                                                                                                                                 | 
                                                             				if ($addspecialentries) {    // Add dedicated entries for groups of countries | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    997
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    997
                                                                                                                                                                                                 | 
                                                             					//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    998
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    999
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    998
                                                                                                                                                                                                 | 
                                                            +					$out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    999
                                                                                                                                                                                                 | 
                                                            +					$out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1000
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1000
                                                                                                                                                                                                 | 
                                                             					if ($mysoc->isInEEC()) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1001
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1001
                                                                                                                                                                                                 | 
                                                            +						$out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1002
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1002
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1003
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1003
                                                                                                                                                                                                 | 
                                                            +					$out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1004
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1004
                                                                                                                                                                                                 | 
                                                             					$out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1005
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1005
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1006
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1006
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1028,20 +1028,20 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1028
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1028
                                                                                                                                                                                                 | 
                                                             						$labeltoshow .= ' ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1029
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1029
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1030
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1030
                                                                                                                                                                                                 | 
                                                             					if ($row['code_iso']) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1031
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1031
                                                                                                                                                                                                 | 
                                                            +						$labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1032
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1032
                                                                                                                                                                                                 | 
                                                             						if (empty($hideflags)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1033
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1033
                                                                                                                                                                                                 | 
                                                             							$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1034
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$labeltoshow = $tmpflag . ' ' . $labeltoshow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1034
                                                                                                                                                                                                 | 
                                                            +							$labeltoshow = $tmpflag.' '.$labeltoshow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1035
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1035
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1036
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1036
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1037
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1037
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1038
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1038
                                                                                                                                                                                                 | 
                                                             					if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1039
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$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
                                                                                                                                                                                                 | 
                                                            +						$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']).'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1040
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1040
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1041
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$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
                                                                                                                                                                                                 | 
                                                            +						$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']).'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1042
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1042
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1043
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1043
                                                                                                                                                                                                 | 
                                                             					$out .= $labeltoshow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1044
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '</option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1044
                                                                                                                                                                                                 | 
                                                            +					$out .= '</option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1045
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1045
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1046
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1046
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1047
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1047
                                                                                                                                                                                                 | 
                                                             			$out .= '</select>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1050,8 +1050,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1050
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1050
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1051
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1051
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1052
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1052
                                                                                                                                                                                                 | 
                                                             		// Make select dynamic  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    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
                                                                                                                                                                                                 | 
                                                             		return $out;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1057
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1057
                                                                                                                                                                                                 | 
                                                             	}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1083,25 +1083,25 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1083
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1083
                                                                                                                                                                                                 | 
                                                             		$incotermArray = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1084
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1084
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1085
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1085
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT rowid, code";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1086
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "c_incoterms";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1086
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."c_incoterms";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1087
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1087
                                                                                                                                                                                                 | 
                                                             		$sql .= " WHERE active > 0";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1088
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1088
                                                                                                                                                                                                 | 
                                                             		$sql .= " ORDER BY code ASC";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1089
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1089
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1090
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1090
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1091
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1091
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1092
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1092
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1093
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1093
                                                                                                                                                                                                 | 
                                                             			if ($conf->use_javascript_ajax && !$forcecombo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1094
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1094
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1095
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1095
                                                                                                                                                                                                 | 
                                                             				$out .= ajax_combobox($htmlname, $events);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1096
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1096
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1097
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1097
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1098
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1098
                                                                                                                                                                                                 | 
                                                             			if (!empty($page)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1099
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<form method="post" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1099
                                                                                                                                                                                                 | 
                                                            +				$out .= '<form method="post" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1100
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1100
                                                                                                                                                                                                 | 
                                                             				$out .= '<input type="hidden" name="action" value="set_incoterms">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1101
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1101
                                                                                                                                                                                                 | 
                                                            +				$out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1102
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1102
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1103
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1103
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1104
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1104
                                                                                                                                                                                                 | 
                                                            +			$out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1105
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1105
                                                                                                                                                                                                 | 
                                                             			$out .= '<option value="0"> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1106
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1106
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($resql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1107
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1107
                                                                                                                                                                                                 | 
                                                             			$i = 0;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1115,9 +1115,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1115
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1115
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1116
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1116
                                                                                                                                                                                                 | 
                                                             				foreach ($incotermArray as $row) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1117
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1117
                                                                                                                                                                                                 | 
                                                             					if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1118
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '<option value="' . $row['rowid'] . '" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1118
                                                                                                                                                                                                 | 
                                                            +						$out .= '<option value="'.$row['rowid'].'" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1119
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1119
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1120
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '<option value="' . $row['rowid'] . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1120
                                                                                                                                                                                                 | 
                                                            +						$out .= '<option value="'.$row['rowid'].'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1121
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1121
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1122
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1122
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1123
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1123
                                                                                                                                                                                                 | 
                                                             					if ($row['code']) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1130,13 +1130,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1130
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1130
                                                                                                                                                                                                 | 
                                                             			$out .= '</select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1131
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1131
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1132
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1132
                                                                                                                                                                                                 | 
                                                             			if ($conf->use_javascript_ajax && empty($disableautocomplete)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1133
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1133
                                                                                                                                                                                                 | 
                                                            +				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1134
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1134
                                                                                                                                                                                                 | 
                                                             				$moreattrib .= ' autocomplete="off"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1135
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1135
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1136
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1136
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1137
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1137
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1138
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1138
                                                                                                                                                                                                 | 
                                                             			if (!empty($page)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1139
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1139
                                                                                                                                                                                                 | 
                                                            +				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1140
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1140
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1141
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1141
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1142
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1142
                                                                                                                                                                                                 | 
                                                             			dol_print_error($this->db);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1168,9 +1168,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1168
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1168
                                                                                                                                                                                                 | 
                                                             		if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service")) | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1169
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1169
                                                                                                                                                                                                 | 
                                                             			|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1170
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1170
                                                                                                                                                                                                 | 
                                                             			if (empty($hidetext)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1171
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print $langs->trans("Type") . ': '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1171
                                                                                                                                                                                                 | 
                                                            +				print $langs->trans("Type").': '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1172
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1172
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1173
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1173
                                                                                                                                                                                                 | 
                                                            +			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1174
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1174
                                                                                                                                                                                                 | 
                                                             			if ($showempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1175
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1175
                                                                                                                                                                                                 | 
                                                             				print '<option value="-1"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1176
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1176
                                                                                                                                                                                                 | 
                                                             				if ($selected == -1) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1189,28 +1189,28 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1189
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1189
                                                                                                                                                                                                 | 
                                                             			if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1190
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1190
                                                                                                                                                                                                 | 
                                                             				print ' selected';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1191
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1191
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1192
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '>' . $langs->trans("Product"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1192
                                                                                                                                                                                                 | 
                                                            +			print '>'.$langs->trans("Product"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1193
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1193
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1194
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1194
                                                                                                                                                                                                 | 
                                                             			print '<option value="1"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1195
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1195
                                                                                                                                                                                                 | 
                                                             			if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1196
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1196
                                                                                                                                                                                                 | 
                                                             				print ' selected';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1197
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1197
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1198
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '>' . $langs->trans("Service"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1198
                                                                                                                                                                                                 | 
                                                            +			print '>'.$langs->trans("Service"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1199
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1199
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1200
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1200
                                                                                                                                                                                                 | 
                                                             			print '</select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1201
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print ajax_combobox('select_' . $htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1201
                                                                                                                                                                                                 | 
                                                            +			print ajax_combobox('select_'.$htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1202
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1202
                                                                                                                                                                                                 | 
                                                             			//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1203
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1203
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1204
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1204
                                                                                                                                                                                                 | 
                                                             		if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1205
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1205
                                                                                                                                                                                                 | 
                                                             			print $langs->trans("Service"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1206
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="hidden" name="' . $htmlname . '" value="1">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1206
                                                                                                                                                                                                 | 
                                                            +			print '<input type="hidden" name="'.$htmlname.'" value="1">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1207
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1207
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1208
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1208
                                                                                                                                                                                                 | 
                                                             		if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1209
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1209
                                                                                                                                                                                                 | 
                                                             			print $langs->trans("Product"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1210
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="hidden" name="' . $htmlname . '" value="0">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1210
                                                                                                                                                                                                 | 
                                                            +			print '<input type="hidden" name="'.$htmlname.'" value="0">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1211
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1211
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1212
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1212
                                                                                                                                                                                                 | 
                                                             		if ($forceall < 0) {    // This should happened only for contracts when both predefined product and service are disabled. | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1213
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			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  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1213
                                                                                                                                                                                                 | 
                                                            +			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  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1214
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1214
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1215
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1215
                                                                                                                                                                                                 | 
                                                             	}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1216
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1216
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1236,7 +1236,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1236
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1236
                                                                                                                                                                                                 | 
                                                             		$langs->load("trips"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1237
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1237
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1238
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1238
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT c.code, c.label";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1239
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "c_type_fees as c";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1239
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."c_type_fees as c";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1240
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1240
                                                                                                                                                                                                 | 
                                                             		$sql .= " WHERE active > 0";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1241
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1241
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1242
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1242
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1277,11 +1277,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1277
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1277
                                                                                                                                                                                                 | 
                                                             		// phpcs:enable  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1278
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1278
                                                                                                                                                                                                 | 
                                                             		global $user, $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1279
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1279
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1280
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1280
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1281
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1281
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1282
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1282
                                                                                                                                                                                                 | 
                                                             		$this->load_cache_types_fees();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1283
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1283
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1284
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1284
                                                                                                                                                                                                 | 
                                                            +		print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1285
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1285
                                                                                                                                                                                                 | 
                                                             		if ($showempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1286
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1286
                                                                                                                                                                                                 | 
                                                             			print '<option value="-1"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1287
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1287
                                                                                                                                                                                                 | 
                                                             			if ($selected == -1) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1291,7 +1291,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1291
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1291
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1292
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1292
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1293
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1293
                                                                                                                                                                                                 | 
                                                             		foreach ($this->cache_types_fees as $key => $value) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1294
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<option value="' . $key . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1294
                                                                                                                                                                                                 | 
                                                            +			print '<option value="'.$key.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1295
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1295
                                                                                                                                                                                                 | 
                                                             			if ($key == $selected) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1296
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1296
                                                                                                                                                                                                 | 
                                                             				print ' selected';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1297
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1297
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1343,12 +1343,12 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1343
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1343
                                                                                                                                                                                                 | 
                                                             				$ajaxoptions = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1344
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1344
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1345
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1345
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1346
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1346
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1347
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1347
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1348
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1348
                                                                                                                                                                                                 | 
                                                             			// No immediate load of all database  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1349
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1349
                                                                                                                                                                                                 | 
                                                             			$placeholder = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1350
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1350
                                                                                                                                                                                                 | 
                                                             			if ($selected && empty($selected_input_value)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1351
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1351
                                                                                                                                                                                                 | 
                                                            +				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1352
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1352
                                                                                                                                                                                                 | 
                                                             				$societetmp = new Societe($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1353
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1353
                                                                                                                                                                                                 | 
                                                             				$societetmp->fetch($selected);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1354
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1354
                                                                                                                                                                                                 | 
                                                             				$selected_input_value = $societetmp->name;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1356,18 +1356,18 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1356
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1356
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1357
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1357
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1358
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1358
                                                                                                                                                                                                 | 
                                                             			// mode 1  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1359
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$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)) : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1359
                                                                                                                                                                                                 | 
                                                            +			$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)) : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1360
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1360
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1361
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1361
                                                                                                                                                                                                 | 
                                                             			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1362
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1362
                                                                                                                                                                                                 | 
                                                             			if (empty($hidelabel)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1363
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print $langs->trans("RefOrLabel") . ' : '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1363
                                                                                                                                                                                                 | 
                                                            +				print $langs->trans("RefOrLabel").' : '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1364
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1364
                                                                                                                                                                                                 | 
                                                             			} elseif ($hidelabel > 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1365
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1365
                                                                                                                                                                                                 | 
                                                             				$placeholder = $langs->trans("RefOrLabel"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1366
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1366
                                                                                                                                                                                                 | 
                                                             				if ($hidelabel == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1367
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1367
                                                                                                                                                                                                 | 
                                                             					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1368
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1368
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1369
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1369
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1370
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1370
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1371
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1371
                                                                                                                                                                                                 | 
                                                             			if ($hidelabel == 3) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1372
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1372
                                                                                                                                                                                                 | 
                                                             				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1373
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1373
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1429,12 +1429,12 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1429
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1429
                                                                                                                                                                                                 | 
                                                             				$events = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1430
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1430
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1431
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1431
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1432
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1432
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1433
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1433
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1434
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1434
                                                                                                                                                                                                 | 
                                                             			// No immediate load of all database  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1435
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1435
                                                                                                                                                                                                 | 
                                                             			$placeholder = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1436
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1436
                                                                                                                                                                                                 | 
                                                             			if ($selected && empty($selected_input_value)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1437
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1437
                                                                                                                                                                                                 | 
                                                            +				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1438
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1438
                                                                                                                                                                                                 | 
                                                             				$contacttmp = new Contact($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1439
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1439
                                                                                                                                                                                                 | 
                                                             				$contacttmp->fetch($selected);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1440
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1440
                                                                                                                                                                                                 | 
                                                             				$selected_input_value = $contacttmp->getFullName($langs);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1445,11 +1445,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1445
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1445
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1446
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1446
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1447
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1447
                                                                                                                                                                                                 | 
                                                             			// mode 1  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1448
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($exclude) ? '' : '&exclude=' . urlencode($exclude)) . ($showsoc ? '&showsoc=' . urlencode((string) ($showsoc)) : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1448
                                                                                                                                                                                                 | 
                                                            +			$urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($exclude) ? '' : '&exclude='.urlencode($exclude)).($showsoc ? '&showsoc='.urlencode((string) ($showsoc)) : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1449
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1449
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1450
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1450
                                                                                                                                                                                                 | 
                                                             			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1451
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1451
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1452
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1452
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1453
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1453
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1454
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1454
                                                                                                                                                                                                 | 
                                                             			$out .= ajax_event($htmlname, $events);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1455
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1455
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1546,30 +1546,30 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1546
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1546
                                                                                                                                                                                                 | 
                                                             			$sql .= ", s.address, s.zip, s.town";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1547
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1547
                                                                                                                                                                                                 | 
                                                             			$sql .= ", dictp.code as country_code";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1548
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1548
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1549
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "societe as s";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1549
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."societe as s";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1550
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1550
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1551
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1551
                                                                                                                                                                                                 | 
                                                            +			$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1552
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1552
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1553
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1553
                                                                                                                                                                                                 | 
                                                             		if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1554
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1554
                                                                                                                                                                                                 | 
                                                            +			$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1555
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1555
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1556
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1556
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE s.entity IN (".getEntity('societe').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1557
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1557
                                                                                                                                                                                                 | 
                                                             		if (!empty($user->socid)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1558
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND s.rowid = " . ((int) $user->socid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1558
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND s.rowid = ".((int) $user->socid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1559
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1559
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1560
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1560
                                                                                                                                                                                                 | 
                                                             		if ($filter) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1561
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1561
                                                                                                                                                                                                 | 
                                                             			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1562
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1562
                                                                                                                                                                                                 | 
                                                             			// if not, by testSqlAndScriptInject() only.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1563
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND (" . $filter . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1563
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND (".$filter.")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1564
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1564
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1565
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1565
                                                                                                                                                                                                 | 
                                                             		if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1566
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1566
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1567
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1567
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1568
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1568
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1569
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1569
                                                                                                                                                                                                 | 
                                                             			$sql .= " AND s.status <> 0";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1570
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1570
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1571
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1571
                                                                                                                                                                                                 | 
                                                             		if (!empty($excludeids)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1572
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1572
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1573
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1573
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1574
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1574
                                                                                                                                                                                                 | 
                                                             		// Add where from hooks  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1575
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1575
                                                                                                                                                                                                 | 
                                                             		$parameters = array();  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1589,17 +1589,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1589
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1589
                                                                                                                                                                                                 | 
                                                             				if ($i > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1590
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1590
                                                                                                                                                                                                 | 
                                                             					$sql .= " AND ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1591
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1591
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1592
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1592
                                                                                                                                                                                                 | 
                                                            +				$sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1593
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1593
                                                                                                                                                                                                 | 
                                                             				$i++;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1594
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1594
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1595
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1595
                                                                                                                                                                                                 | 
                                                             			if (count($search_crit) > 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1596
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1596
                                                                                                                                                                                                 | 
                                                             				$sql .= ")";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1597
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1597
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1598
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1598
                                                                                                                                                                                                 | 
                                                             			if (isModEnabled('barcode')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1599
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1599
                                                                                                                                                                                                 | 
                                                            +				$sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1600
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1600
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1601
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1602
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1601
                                                                                                                                                                                                 | 
                                                            +			$sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1602
                                                                                                                                                                                                 | 
                                                            +			$sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1603
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1603
                                                                                                                                                                                                 | 
                                                             			$sql .= ")";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1604
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1604
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1605
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1605
                                                                                                                                                                                                 | 
                                                             		$sql .= $this->db->order("nom", "ASC"); | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1610,7 +1610,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1610
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1610
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1611
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1611
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1612
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1612
                                                                                                                                                                                                 | 
                                                             			// Construct $out and $outarray  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1613
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1613
                                                                                                                                                                                                 | 
                                                            +			$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1614
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1614
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1615
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1615
                                                                                                                                                                                                 | 
                                                             			$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1616
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1616
                                                                                                                                                                                                 | 
                                                             			if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1623,7 +1623,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1623
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1623
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1624
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1624
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1625
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1625
                                                                                                                                                                                                 | 
                                                             			if ($showempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1626
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : ' ') . '</span>') . '">' . $textifempty . '</option>' . "\n"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1626
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1627
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1627
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1628
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1628
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1629
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1629
                                                                                                                                                                                                 | 
                                                             			$companytemp = new Societe($this->db);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1636,18 +1636,18 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1636
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1636
                                                                                                                                                                                                 | 
                                                             					$label = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1637
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1637
                                                                                                                                                                                                 | 
                                                             					if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1638
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1638
                                                                                                                                                                                                 | 
                                                             						if (($obj->client) && (!empty($obj->code_client))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1639
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$label = $obj->code_client . ' - ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1639
                                                                                                                                                                                                 | 
                                                            +							$label = $obj->code_client.' - ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1640
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1640
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1641
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1641
                                                                                                                                                                                                 | 
                                                             						if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1642
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$label .= $obj->code_fournisseur . ' - ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1642
                                                                                                                                                                                                 | 
                                                            +							$label .= $obj->code_fournisseur.' - ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1643
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1643
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1644
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$label .= ' ' . $obj->name;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1644
                                                                                                                                                                                                 | 
                                                            +						$label .= ' '.$obj->name;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1645
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1645
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1646
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1646
                                                                                                                                                                                                 | 
                                                             						$label = $obj->name;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1647
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1647
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1648
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1648
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1649
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1649
                                                                                                                                                                                                 | 
                                                             					if (!empty($obj->name_alias)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1650
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$label .= ' (' . $obj->name_alias . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1650
                                                                                                                                                                                                 | 
                                                            +						$label .= ' ('.$obj->name_alias.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1651
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1651
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1652
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1652
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1653
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1653
                                                                                                                                                                                                 | 
                                                             					if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1662,7 +1662,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1662
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1662
                                                                                                                                                                                                 | 
                                                             						$companytemp->fournisseur = $obj->fournisseur;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1663
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1663
                                                                                                                                                                                                 | 
                                                             						$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1664
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1664
                                                                                                                                                                                                 | 
                                                             						if ($tmptype) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1665
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$labelhtml .= ' ' . $tmptype;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1665
                                                                                                                                                                                                 | 
                                                            +							$labelhtml .= ' '.$tmptype;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1666
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1666
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1667
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1667
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1668
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1668
                                                                                                                                                                                                 | 
                                                             						if ($obj->client || $obj->fournisseur) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1672,10 +1672,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1672
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1672
                                                                                                                                                                                                 | 
                                                             							$label .= $langs->trans("Customer"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1673
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1673
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1674
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1674
                                                                                                                                                                                                 | 
                                                             						if ($obj->client == 2 || $obj->client == 3) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1675
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1675
                                                                                                                                                                                                 | 
                                                            +							$label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1676
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1676
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1677
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1677
                                                                                                                                                                                                 | 
                                                             						if ($obj->fournisseur) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1678
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1678
                                                                                                                                                                                                 | 
                                                            +							$label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1679
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1679
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1680
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1680
                                                                                                                                                                                                 | 
                                                             						if ($obj->client || $obj->fournisseur) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1681
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1681
                                                                                                                                                                                                 | 
                                                             							$label .= ')';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1683,9 +1683,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1683
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1683
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1684
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1684
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1685
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1685
                                                                                                                                                                                                 | 
                                                             					if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1686
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1686
                                                                                                                                                                                                 | 
                                                            +						$s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1687
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1687
                                                                                                                                                                                                 | 
                                                             						if (!empty($obj->country_code)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1688
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$s .= ', ' . $langs->trans('Country' . $obj->country_code); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1688
                                                                                                                                                                                                 | 
                                                            +							$s .= ', '.$langs->trans('Country'.$obj->country_code); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1689
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1689
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1690
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1690
                                                                                                                                                                                                 | 
                                                             						$label .= $s;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1691
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1691
                                                                                                                                                                                                 | 
                                                             						$labelhtml .= $s;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1693,9 +1693,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1693
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1693
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1694
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1694
                                                                                                                                                                                                 | 
                                                             					if (empty($outputmode)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1695
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1695
                                                                                                                                                                                                 | 
                                                             						if (in_array($obj->rowid, $selected)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1696
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1696
                                                                                                                                                                                                 | 
                                                            +							$out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1697
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1697
                                                                                                                                                                                                 | 
                                                             						} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1698
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1698
                                                                                                                                                                                                 | 
                                                            +							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1699
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1699
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1700
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1700
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1701
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1701
                                                                                                                                                                                                 | 
                                                             						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml)); | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1707,9 +1707,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1707
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1707
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1708
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1708
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1709
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1709
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1710
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '</select>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1710
                                                                                                                                                                                                 | 
                                                            +			$out .= '</select>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1711
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1711
                                                                                                                                                                                                 | 
                                                             			if (!$forcecombo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1712
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1712
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1713
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1713
                                                                                                                                                                                                 | 
                                                             				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT")); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1714
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1714
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1715
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1715
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1799,7 +1799,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1799
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1799
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1800
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1800
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1801
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1801
                                                                                                                                                                                                 | 
                                                             		if (!is_object($hookmanager)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1802
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1802
                                                                                                                                                                                                 | 
                                                            +			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1803
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1803
                                                                                                                                                                                                 | 
                                                             			$hookmanager = new HookManager($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1804
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1804
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1805
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1805
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1808,13 +1808,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1808
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1808
                                                                                                                                                                                                 | 
                                                             		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1809
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1809
                                                                                                                                                                                                 | 
                                                             			$sql .= ", s.nom as company, s.town AS company_town";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1810
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1810
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1811
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "socpeople as sp";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1811
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."socpeople as sp";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1812
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1812
                                                                                                                                                                                                 | 
                                                             		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1813
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " LEFT OUTER JOIN  " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1813
                                                                                                                                                                                                 | 
                                                            +			$sql .= " LEFT OUTER JOIN  ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1814
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1814
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1815
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1815
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE sp.entity IN (".getEntity('contact').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1816
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1816
                                                                                                                                                                                                 | 
                                                             		if ($socid > 0 || $socid == -1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1817
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND sp.fk_soc = " . ((int) $socid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1817
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND sp.fk_soc = ".((int) $socid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1818
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1818
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1819
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1819
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1820
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1820
                                                                                                                                                                                                 | 
                                                             			$sql .= " AND sp.statut <> 0";  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1822,7 +1822,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1822
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1822
                                                                                                                                                                                                 | 
                                                             		if ($filter) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1823
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1823
                                                                                                                                                                                                 | 
                                                             			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1824
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1824
                                                                                                                                                                                                 | 
                                                             			// if not, by testSqlAndScriptInject() only.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1825
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND (" . $filter . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1825
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND (".$filter.")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1826
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1826
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1827
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1827
                                                                                                                                                                                                 | 
                                                             		// Add where from hooks  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1828
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1828
                                                                                                                                                                                                 | 
                                                             		$parameters = array();  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1830,30 +1830,30 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1830
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1830
                                                                                                                                                                                                 | 
                                                             		$sql .= $hookmanager->resPrint;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1831
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1831
                                                                                                                                                                                                 | 
                                                             		$sql .= " ORDER BY sp.lastname ASC";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1832
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1832
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1833
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1833
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1834
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1834
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1835
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1835
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1836
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1836
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($resql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1837
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1837
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1838
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1838
                                                                                                                                                                                                 | 
                                                             			if ($htmlname != 'none' && !$options_only) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1839
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1839
                                                                                                                                                                                                 | 
                                                            +				$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1840
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1840
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1841
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1841
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1842
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1842
                                                                                                                                                                                                 | 
                                                             			if ($showempty && !is_numeric($showempty)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1843
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1843
                                                                                                                                                                                                 | 
                                                             				$textforempty = $showempty;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1844
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1844
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1845
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1845
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1846
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1846
                                                                                                                                                                                                 | 
                                                             				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1847
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1847
                                                                                                                                                                                                 | 
                                                            +					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1848
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1848
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1849
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1849
                                                                                                                                                                                                 | 
                                                             				if ($showempty == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1850
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1850
                                                                                                                                                                                                 | 
                                                            +					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1851
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1851
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1852
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1852
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1853
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1853
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1854
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1854
                                                                                                                                                                                                 | 
                                                             			$i = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1855
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1855
                                                                                                                                                                                                 | 
                                                             			if ($num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1856
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1856
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1857
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1857
                                                                                                                                                                                                 | 
                                                             				$contactstatic = new Contact($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1858
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1858
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1859
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1859
                                                                                                                                                                                                 | 
                                                             				while ($i < $num) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1889,7 +1889,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1889
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1889
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1890
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1890
                                                                                                                                                                                                 | 
                                                             						$extendedInfos = implode(' - ', $extendedInfos); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1891
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1891
                                                                                                                                                                                                 | 
                                                             						if (!empty($extendedInfos)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1892
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$extendedInfos = ' - ' . $extendedInfos;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1892
                                                                                                                                                                                                 | 
                                                            +							$extendedInfos = ' - '.$extendedInfos;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1893
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1893
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1894
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1894
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1895
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1895
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1907,35 +1907,35 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1907
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1907
                                                                                                                                                                                                 | 
                                                             								$disabled = 1;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1908
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1908
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1909
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1909
                                                                                                                                                                                                 | 
                                                             							if (!empty($selected) && in_array($obj->rowid, $selected)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1910
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$out .= '<option value="' . $obj->rowid . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1910
                                                                                                                                                                                                 | 
                                                            +								$out .= '<option value="'.$obj->rowid.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1911
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1911
                                                                                                                                                                                                 | 
                                                             								if ($disabled) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1912
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1912
                                                                                                                                                                                                 | 
                                                             									$out .= ' disabled';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1913
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1913
                                                                                                                                                                                                 | 
                                                             								}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1914
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1914
                                                                                                                                                                                                 | 
                                                             								$out .= ' selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1915
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1915
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1916
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1916
                                                                                                                                                                                                 | 
                                                            +								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1917
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1917
                                                                                                                                                                                                 | 
                                                             								if ($showfunction && $obj->poste) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1918
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -									$tmplabel .= ' (' . $obj->poste . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1918
                                                                                                                                                                                                 | 
                                                            +									$tmplabel .= ' ('.$obj->poste.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1919
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1919
                                                                                                                                                                                                 | 
                                                             								}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1920
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1920
                                                                                                                                                                                                 | 
                                                             								if (($showsoc > 0) && $obj->company) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1921
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -									$tmplabel .= ' - (' . $obj->company . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1921
                                                                                                                                                                                                 | 
                                                            +									$tmplabel .= ' - ('.$obj->company.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1922
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1922
                                                                                                                                                                                                 | 
                                                             								}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1923
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1923
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1924
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1924
                                                                                                                                                                                                 | 
                                                             								$out .= $tmplabel;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1925
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1925
                                                                                                                                                                                                 | 
                                                             								$out .= '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1926
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1926
                                                                                                                                                                                                 | 
                                                             							} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1927
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$out .= '<option value="' . $obj->rowid . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1927
                                                                                                                                                                                                 | 
                                                            +								$out .= '<option value="'.$obj->rowid.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1928
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1928
                                                                                                                                                                                                 | 
                                                             								if ($disabled) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1929
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1929
                                                                                                                                                                                                 | 
                                                             									$out .= ' disabled';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1930
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1930
                                                                                                                                                                                                 | 
                                                             								}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1931
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1931
                                                                                                                                                                                                 | 
                                                             								$out .= '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1932
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1932
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1933
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1933
                                                                                                                                                                                                 | 
                                                            +								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1934
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1934
                                                                                                                                                                                                 | 
                                                             								if ($showfunction && $obj->poste) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1935
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -									$tmplabel .= ' (' . $obj->poste . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1935
                                                                                                                                                                                                 | 
                                                            +									$tmplabel .= ' ('.$obj->poste.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1936
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1936
                                                                                                                                                                                                 | 
                                                             								}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1937
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1937
                                                                                                                                                                                                 | 
                                                             								if (($showsoc > 0) && $obj->company) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1938
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -									$tmplabel .= ' - (' . $obj->company . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1938
                                                                                                                                                                                                 | 
                                                            +									$tmplabel .= ' - ('.$obj->company.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1939
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1939
                                                                                                                                                                                                 | 
                                                             								}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1940
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1940
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1941
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1941
                                                                                                                                                                                                 | 
                                                             								$out .= $tmplabel;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1943,12 +1943,12 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1943
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1943
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1944
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1944
                                                                                                                                                                                                 | 
                                                             						} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1945
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1945
                                                                                                                                                                                                 | 
                                                             							if (in_array($obj->rowid, $selected)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1946
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1946
                                                                                                                                                                                                 | 
                                                            +								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1947
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1947
                                                                                                                                                                                                 | 
                                                             								if ($showfunction && $obj->poste) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1948
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -									$tmplabel .= ' (' . $obj->poste . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1948
                                                                                                                                                                                                 | 
                                                            +									$tmplabel .= ' ('.$obj->poste.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1949
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1949
                                                                                                                                                                                                 | 
                                                             								}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1950
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1950
                                                                                                                                                                                                 | 
                                                             								if (($showsoc > 0) && $obj->company) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1951
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -									$tmplabel .= ' - (' . $obj->company . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1951
                                                                                                                                                                                                 | 
                                                            +									$tmplabel .= ' - ('.$obj->company.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1952
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1952
                                                                                                                                                                                                 | 
                                                             								}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1953
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1953
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1954
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1954
                                                                                                                                                                                                 | 
                                                             								$out .= $tmplabel;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1963,7 +1963,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1963
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1963
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1964
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1964
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1965
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1965
                                                                                                                                                                                                 | 
                                                             				$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1966
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1966
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1967
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1967
                                                                                                                                                                                                 | 
                                                             				$out .= $labeltoshow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1968
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1968
                                                                                                                                                                                                 | 
                                                             				$out .= '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1969
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1969
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -1984,7 +1984,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    1984
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1984
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1985
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1985
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1986
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1986
                                                                                                                                                                                                 | 
                                                             			if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1987
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    1987
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1988
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1988
                                                                                                                                                                                                 | 
                                                             				$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT")); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1989
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1989
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    1990
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    1990
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2023,18 +2023,18 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2023
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2023
                                                                                                                                                                                                 | 
                                                             		// On recherche les remises  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2024
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2024
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2025
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2025
                                                                                                                                                                                                 | 
                                                             		$sql .= " re.description, re.fk_facture_source";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2026
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2027
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE re.fk_soc = " . (int) $socid;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2028
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " AND re.entity = " . $conf->entity;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2026
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."societe_remise_except as re";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2027
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE re.fk_soc = ".(int) $socid;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2028
                                                                                                                                                                                                 | 
                                                            +		$sql .= " AND re.entity = ".$conf->entity;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2029
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2029
                                                                                                                                                                                                 | 
                                                             		if ($filter) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2030
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND " . $filter;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2030
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND ".$filter;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2031
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2031
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2032
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2032
                                                                                                                                                                                                 | 
                                                             		$sql .= " ORDER BY re.description ASC";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2033
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2033
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2034
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2034
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2035
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2035
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2036
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2036
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2037
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2037
                                                                                                                                                                                                 | 
                                                            +			print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2038
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2038
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($resql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2039
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2039
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2040
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2040
                                                                                                                                                                                                 | 
                                                             			$qualifiedlines = $num;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2072,16 +2072,16 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2072
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2072
                                                                                                                                                                                                 | 
                                                             					if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2073
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2073
                                                                                                                                                                                                 | 
                                                             						$tmpfac = new Facture($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2074
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2074
                                                                                                                                                                                                 | 
                                                             						if ($tmpfac->fetch($obj->fk_facture_source) > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2075
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$desc = $desc . ' - ' . $tmpfac->ref;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2075
                                                                                                                                                                                                 | 
                                                            +							$desc = $desc.' - '.$tmpfac->ref;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2076
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2076
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2077
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2077
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2078
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2078
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2079
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2079
                                                                                                                                                                                                 | 
                                                            +					print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2080
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2080
                                                                                                                                                                                                 | 
                                                             					$i++;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2081
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2081
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2082
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2082
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2083
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2083
                                                                                                                                                                                                 | 
                                                             			print '</select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2084
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print ajax_combobox('select_' . $htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2084
                                                                                                                                                                                                 | 
                                                            +			print ajax_combobox('select_'.$htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2085
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2085
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2086
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2086
                                                                                                                                                                                                 | 
                                                             			return $qualifiedlines;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2087
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2087
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2188,14 +2188,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2188
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2188
                                                                                                                                                                                                 | 
                                                             		if ($showlabelofentity) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2189
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2189
                                                                                                                                                                                                 | 
                                                             			$sql .= ", e.label";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2190
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2190
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2191
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "user as u";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2191
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."user as u";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2192
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2192
                                                                                                                                                                                                 | 
                                                             		if ($showlabelofentity) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2193
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2193
                                                                                                                                                                                                 | 
                                                            +			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2194
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2194
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2195
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2195
                                                                                                                                                                                                 | 
                                                             		// Condition here should be the same than into societe->getSalesRepresentatives().  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2196
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2196
                                                                                                                                                                                                 | 
                                                             		if ($userissuperadminentityone && $force_entity != 'default') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2197
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2197
                                                                                                                                                                                                 | 
                                                             			if (!empty($force_entity)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2198
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2198
                                                                                                                                                                                                 | 
                                                            +				$sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2199
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2199
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2200
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2200
                                                                                                                                                                                                 | 
                                                             				$sql .= " WHERE u.entity IS NOT NULL";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2201
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2201
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2203,18 +2203,18 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2203
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2203
                                                                                                                                                                                                 | 
                                                             			if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2204
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2204
                                                                                                                                                                                                 | 
                                                             				$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2205
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2205
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2206
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2206
                                                                                                                                                                                                 | 
                                                            +				$sql .= " WHERE u.entity IN (".getEntity('user').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2207
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2207
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2208
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2208
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2209
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2209
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2210
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2210
                                                                                                                                                                                                 | 
                                                             		if (!empty($user->socid)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2211
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND u.fk_soc = " . ((int) $user->socid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2211
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND u.fk_soc = ".((int) $user->socid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2212
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2212
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2213
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2213
                                                                                                                                                                                                 | 
                                                             		if (is_array($exclude) && $excludeUsers) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2214
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2214
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2215
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2215
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2216
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2216
                                                                                                                                                                                                 | 
                                                             		if ($includeUsers) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2217
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2217
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2218
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2218
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2219
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2219
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2220
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2220
                                                                                                                                                                                                 | 
                                                             			$sql .= " AND u.statut <> 0";  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2226,7 +2226,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2226
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2226
                                                                                                                                                                                                 | 
                                                             			$sql .= " AND u.fk_soc IS NULL";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2227
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2227
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2228
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2228
                                                                                                                                                                                                 | 
                                                             		if (!empty($morefilter)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2229
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " " . $morefilter;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2229
                                                                                                                                                                                                 | 
                                                            +			$sql .= " ".$morefilter;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2230
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2230
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2231
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2231
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2232
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2232
                                                                                                                                                                                                 | 
                                                             		//Add hook to filter on user (for example on usergroup define in custom modules)  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2241,7 +2241,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2241
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2241
                                                                                                                                                                                                 | 
                                                             			$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2242
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2242
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2243
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2243
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2244
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2244
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2245
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2245
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2246
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2246
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2247
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2247
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2249,7 +2249,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2249
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2249
                                                                                                                                                                                                 | 
                                                             			$i = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2250
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2250
                                                                                                                                                                                                 | 
                                                             			if ($num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2251
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2251
                                                                                                                                                                                                 | 
                                                             				// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2252
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2252
                                                                                                                                                                                                 | 
                                                            +				$out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2253
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2253
                                                                                                                                                                                                 | 
                                                             				if ($show_empty && !$multiple) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2254
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2254
                                                                                                                                                                                                 | 
                                                             					$textforempty = ' ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2255
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2255
                                                                                                                                                                                                 | 
                                                             					if (!empty($conf->use_javascript_ajax)) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2258,10 +2258,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2258
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2258
                                                                                                                                                                                                 | 
                                                             					if (!is_numeric($show_empty)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2259
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2259
                                                                                                                                                                                                 | 
                                                             						$textforempty = $show_empty;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2260
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2260
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2261
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2261
                                                                                                                                                                                                 | 
                                                            +					$out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2262
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2262
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2263
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2263
                                                                                                                                                                                                 | 
                                                             				if ($show_every) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2264
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2264
                                                                                                                                                                                                 | 
                                                            +					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2265
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2265
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2266
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2266
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2267
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2267
                                                                                                                                                                                                 | 
                                                             				$userstatic = new User($this->db);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2309,21 +2309,21 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2309
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2309
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2310
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2310
                                                                                                                                                                                                 | 
                                                             					if ($showstatus >= 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2311
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2311
                                                                                                                                                                                                 | 
                                                             						if ($obj->status == 1 && $showstatus == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2312
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2313
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2312
                                                                                                                                                                                                 | 
                                                            +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2313
                                                                                                                                                                                                 | 
                                                            +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2314
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2314
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2315
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2315
                                                                                                                                                                                                 | 
                                                             						if ($obj->status == 0 && $showstatus == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2316
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2317
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2316
                                                                                                                                                                                                 | 
                                                            +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2317
                                                                                                                                                                                                 | 
                                                            +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2318
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2318
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2319
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2319
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2320
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2320
                                                                                                                                                                                                 | 
                                                             					if ($showlabelofentity) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2321
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2321
                                                                                                                                                                                                 | 
                                                             						if (empty($obj->entity)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2322
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2323
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2322
                                                                                                                                                                                                 | 
                                                            +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2323
                                                                                                                                                                                                 | 
                                                            +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2324
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2324
                                                                                                                                                                                                 | 
                                                             						} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2325
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2325
                                                                                                                                                                                                 | 
                                                             							if ($obj->entity != $conf->entity) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2326
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2326
                                                                                                                                                                                                 | 
                                                            +								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2327
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2327
                                                                                                                                                                                                 | 
                                                             								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2328
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2328
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2329
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2329
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2332,13 +2332,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2332
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2332
                                                                                                                                                                                                 | 
                                                             					$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2333
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2333
                                                                                                                                                                                                 | 
                                                             					if (!empty($disableline) && $disableline != '1') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2334
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2334
                                                                                                                                                                                                 | 
                                                             						// Add text from $enableonlytext parameter  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2335
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$moreinfo .= ' - ' . $disableline;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2336
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$moreinfohtml .= ' - ' . $disableline;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2335
                                                                                                                                                                                                 | 
                                                            +						$moreinfo .= ' - '.$disableline;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2336
                                                                                                                                                                                                 | 
                                                            +						$moreinfohtml .= ' - '.$disableline;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2337
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2337
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2338
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2338
                                                                                                                                                                                                 | 
                                                             					$labeltoshow .= $moreinfo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2339
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2339
                                                                                                                                                                                                 | 
                                                             					$labeltoshowhtml .= $moreinfohtml;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2340
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2340
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2341
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<option value="' . $obj->rowid . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2341
                                                                                                                                                                                                 | 
                                                            +					$out .= '<option value="'.$obj->rowid.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2342
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2342
                                                                                                                                                                                                 | 
                                                             					if (!empty($disableline)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2343
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2343
                                                                                                                                                                                                 | 
                                                             						$out .= ' disabled';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2344
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2344
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2347,7 +2347,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2347
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2347
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2348
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2348
                                                                                                                                                                                                 | 
                                                             					$out .= ' data-html="';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2349
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2349
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2350
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2350
                                                                                                                                                                                                 | 
                                                            +					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2351
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2351
                                                                                                                                                                                                 | 
                                                             					if ($showstatus >= 0 && $obj->status == 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2352
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2352
                                                                                                                                                                                                 | 
                                                             						$outhtml .= '<strike class="opacitymediumxxx">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2353
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2353
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2362,7 +2362,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2362
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2362
                                                                                                                                                                                                 | 
                                                             					$out .= $labeltoshow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2363
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2363
                                                                                                                                                                                                 | 
                                                             					$out .= '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2364
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2364
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2365
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2365
                                                                                                                                                                                                 | 
                                                            +					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2366
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2366
                                                                                                                                                                                                 | 
                                                             					$outarray2[$userstatic->id] = array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2367
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2367
                                                                                                                                                                                                 | 
                                                             						'id' => $userstatic->id,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2368
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2368
                                                                                                                                                                                                 | 
                                                             						'label' => $labeltoshow,  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2374,14 +2374,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2374
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2374
                                                                                                                                                                                                 | 
                                                             					$i++;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2375
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2375
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2376
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2376
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2377
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2378
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="">' . $langs->trans("None") . '</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2377
                                                                                                                                                                                                 | 
                                                            +				$out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2378
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="">'.$langs->trans("None").'</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2379
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2379
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2380
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2380
                                                                                                                                                                                                 | 
                                                             			$out .= '</select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2381
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2381
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2382
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2382
                                                                                                                                                                                                 | 
                                                             			if ($num && !$forcecombo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2383
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2383
                                                                                                                                                                                                 | 
                                                             				// Enhance with select2  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2384
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2384
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2385
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2385
                                                                                                                                                                                                 | 
                                                             				$out .= ajax_combobox($htmlname);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2386
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2386
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2387
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2387
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2455,16 +2455,16 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2455
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2455
                                                                                                                                                                                                 | 
                                                             			$out .= $userstatic->getNomUrl(-1);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2456
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2456
                                                                                                                                                                                                 | 
                                                             			if ($i == 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2457
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2457
                                                                                                                                                                                                 | 
                                                             				$ownerid = $value['id'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2458
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= ' (' . $langs->trans("Owner") . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2458
                                                                                                                                                                                                 | 
                                                            +				$out .= ' ('.$langs->trans("Owner").')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2459
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2459
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2460
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2460
                                                                                                                                                                                                 | 
                                                             			if ($nbassignetouser > 1 && $action != 'view') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2461
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$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 . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2461
                                                                                                                                                                                                 | 
                                                            +				$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.'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2462
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2462
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2463
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2463
                                                                                                                                                                                                 | 
                                                             			// Show my availability  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2464
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2464
                                                                                                                                                                                                 | 
                                                             			if ($showproperties) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2465
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2465
                                                                                                                                                                                                 | 
                                                             				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2466
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2466
                                                                                                                                                                                                 | 
                                                             					$out .= '<div class="myavailability inline-block">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2467
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$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>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2467
                                                                                                                                                                                                 | 
                                                            +					$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>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2468
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2468
                                                                                                                                                                                                 | 
                                                             					$out .= '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2469
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2469
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2470
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2470
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2481,15 +2481,15 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2481
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2481
                                                                                                                                                                                                 | 
                                                             		// Method with no ajax  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2482
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2482
                                                                                                                                                                                                 | 
                                                             		if ($action != 'view') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2483
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2483
                                                                                                                                                                                                 | 
                                                             			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2484
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2484
                                                                                                                                                                                                 | 
                                                            +			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2485
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2485
                                                                                                                                                                                                 | 
                                                             			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2486
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2486
                                                                                                                                                                                                 | 
                                                             			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2487
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2488
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2487
                                                                                                                                                                                                 | 
                                                            +			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2488
                                                                                                                                                                                                 | 
                                                            +			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2489
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2489
                                                                                                                                                                                                 | 
                                                             			$out .= '});';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2490
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2490
                                                                                                                                                                                                 | 
                                                             			$out .= '})</script>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2491
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2491
                                                                                                                                                                                                 | 
                                                             			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2492
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2492
                                                                                                                                                                                                 | 
                                                            +			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2493
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2493
                                                                                                                                                                                                 | 
                                                             			$out .= '<br>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2494
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2494
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2495
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2495
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2548,13 +2548,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2548
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2548
                                                                                                                                                                                                 | 
                                                             			$resourcestatic->fetch($value['id']);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2549
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2549
                                                                                                                                                                                                 | 
                                                             			$out .= $resourcestatic->getNomUrl(-1);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2550
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2550
                                                                                                                                                                                                 | 
                                                             			if ($nbassignetoresource > 1 && $action != 'view') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2551
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $resourcestatic->id . '" class="removedassigned reposition" id="removedassignedresource_' . $resourcestatic->id . '" name="removedassignedresource_' . $resourcestatic->id . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2551
                                                                                                                                                                                                 | 
                                                            +				$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$resourcestatic->id.'" class="removedassigned reposition" id="removedassignedresource_'.$resourcestatic->id.'" name="removedassignedresource_'.$resourcestatic->id.'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2552
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2552
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2553
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2553
                                                                                                                                                                                                 | 
                                                             			// Show my availability  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2554
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2554
                                                                                                                                                                                                 | 
                                                             			if ($showproperties) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2555
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2555
                                                                                                                                                                                                 | 
                                                             				if (is_array($listofresourceid) && count($listofresourceid)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2556
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2556
                                                                                                                                                                                                 | 
                                                             					$out .= '<div class="myavailability inline-block">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2557
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$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>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2557
                                                                                                                                                                                                 | 
                                                            +					$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>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2558
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2558
                                                                                                                                                                                                 | 
                                                             					$out .= '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2559
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2559
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2560
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2560
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2571,11 +2571,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2571
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2571
                                                                                                                                                                                                 | 
                                                             		// Method with no ajax  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2572
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2572
                                                                                                                                                                                                 | 
                                                             		if ($action != 'view') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2573
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2573
                                                                                                                                                                                                 | 
                                                             			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2574
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2574
                                                                                                                                                                                                 | 
                                                            +			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2575
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2575
                                                                                                                                                                                                 | 
                                                             			$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2576
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2576
                                                                                                                                                                                                 | 
                                                             			$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2577
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2578
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2577
                                                                                                                                                                                                 | 
                                                            +			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2578
                                                                                                                                                                                                 | 
                                                            +			$out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2579
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2579
                                                                                                                                                                                                 | 
                                                             			$out .= '});';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2580
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2580
                                                                                                                                                                                                 | 
                                                             			$out .= '})</script>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2581
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2581
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2583,7 +2583,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2583
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2583
                                                                                                                                                                                                 | 
                                                             			$out .= img_picto('', 'resource', 'class="pictofixedwidth"'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2584
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2584
                                                                                                                                                                                                 | 
                                                             			$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2585
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2585
                                                                                                                                                                                                 | 
                                                             			//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2586
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2586
                                                                                                                                                                                                 | 
                                                            +			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2587
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2587
                                                                                                                                                                                                 | 
                                                             			$out .= '<br>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2588
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2588
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2589
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2589
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2645,7 +2645,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2645
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2645
                                                                                                                                                                                                 | 
                                                             			$placeholder = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2646
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2646
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2647
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2647
                                                                                                                                                                                                 | 
                                                             			if ($selected && empty($selected_input_value)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2648
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2648
                                                                                                                                                                                                 | 
                                                            +				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2649
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2649
                                                                                                                                                                                                 | 
                                                             				$producttmpselect = new Product($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2650
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2650
                                                                                                                                                                                                 | 
                                                             				$producttmpselect->fetch($selected);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2651
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2651
                                                                                                                                                                                                 | 
                                                             				$selected_input_value = $producttmpselect->ref;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2660,17 +2660,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2660
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2660
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2661
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2661
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2662
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2662
                                                                                                                                                                                                 | 
                                                             			// mode=1 means customers products  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2663
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$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;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2664
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2663
                                                                                                                                                                                                 | 
                                                            +			$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;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2664
                                                                                                                                                                                                 | 
                                                            +			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2665
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2665
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2666
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2666
                                                                                                                                                                                                 | 
                                                             			if (isModEnabled('variants') && is_array($selected_combinations)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2667
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2667
                                                                                                                                                                                                 | 
                                                             				// Code to automatically insert with javascript the select of attributes under the select of product  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2668
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2668
                                                                                                                                                                                                 | 
                                                             				// when a parent of variant has been selected.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2669
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2669
                                                                                                                                                                                                 | 
                                                             				$out .= '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2670
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2670
                                                                                                                                                                                                 | 
                                                             				<!-- script to auto show attributes select tags if a variant was selected -->  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2671
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				<script nonce="' . getNonce() . '">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2671
                                                                                                                                                                                                 | 
                                                            +				<script nonce="' . getNonce().'">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2672
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2672
                                                                                                                                                                                                 | 
                                                             					// auto show attributes fields  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2673
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					selected = ' . json_encode($selected_combinations) . ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2673
                                                                                                                                                                                                 | 
                                                            +					selected = ' . json_encode($selected_combinations).';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2674
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2674
                                                                                                                                                                                                 | 
                                                             					combvalues = {}; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2675
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2675
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2676
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2676
                                                                                                                                                                                                 | 
                                                             					jQuery(document).ready(function () { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2681,7 +2681,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2681
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2681
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2682
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2682
                                                                                                                                                                                                 | 
                                                             						});  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2683
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2683
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2684
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						jQuery("input#' . $htmlname . '").change(function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2684
                                                                                                                                                                                                 | 
                                                            +						jQuery("input#' . $htmlname.'").change(function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2685
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2685
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2686
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2686
                                                                                                                                                                                                 | 
                                                             							if (!jQuery(this).val()) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2687
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2687
                                                                                                                                                                                                 | 
                                                             								jQuery(\'div#attributes_box\').empty();  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2690,7 +2690,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2690
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2690
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2691
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2691
                                                                                                                                                                                                 | 
                                                             							console.log("A change has started. We get variants fields to inject html select"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2692
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2692
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2693
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2693
                                                                                                                                                                                                 | 
                                                            +							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2694
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2694
                                                                                                                                                                                                 | 
                                                             								id: jQuery(this).val()  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2695
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2695
                                                                                                                                                                                                 | 
                                                             							}, function (data) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2696
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2696
                                                                                                                                                                                                 | 
                                                             								jQuery(\'div#attributes_box\').empty();  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2733,21 +2733,21 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2733
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2733
                                                                                                                                                                                                 | 
                                                             							})  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2734
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2734
                                                                                                                                                                                                 | 
                                                             						});  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2735
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2735
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2736
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2736
                                                                                                                                                                                                 | 
                                                            +						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2737
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2737
                                                                                                                                                                                                 | 
                                                             					});  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2738
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2738
                                                                                                                                                                                                 | 
                                                             				</script>  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2739
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2739
                                                                                                                                                                                                 | 
                                                                             ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2740
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2740
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2741
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2741
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2742
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2742
                                                                                                                                                                                                 | 
                                                             			if (empty($hidelabel)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2743
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2743
                                                                                                                                                                                                 | 
                                                            +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2744
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2744
                                                                                                                                                                                                 | 
                                                             			} elseif ($hidelabel > 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2745
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2745
                                                                                                                                                                                                 | 
                                                            +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2746
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2746
                                                                                                                                                                                                 | 
                                                             				if ($hidelabel == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2747
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2747
                                                                                                                                                                                                 | 
                                                             					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2748
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2748
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2749
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2749
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2750
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2750
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2751
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2751
                                                                                                                                                                                                 | 
                                                             			if ($hidelabel == 3) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2752
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2752
                                                                                                                                                                                                 | 
                                                             				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2753
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2753
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2784,33 +2784,33 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2784
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2784
                                                                                                                                                                                                 | 
                                                             		// phpcs:enable  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2785
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2785
                                                                                                                                                                                                 | 
                                                             		global $db;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2786
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2786
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2787
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2787
                                                                                                                                                                                                 | 
                                                            +		require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2788
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2788
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2789
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2789
                                                                                                                                                                                                 | 
                                                             		$error = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2790
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2790
                                                                                                                                                                                                 | 
                                                             		$out = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2791
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2791
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2792
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2792
                                                                                                                                                                                                 | 
                                                             		if (!$forcecombo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2793
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2793
                                                                                                                                                                                                 | 
                                                            +			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2794
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2794
                                                                                                                                                                                                 | 
                                                             			$events = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2795
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2795
                                                                                                                                                                                                 | 
                                                             			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2796
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2796
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2797
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2797
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2798
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2798
                                                                                                                                                                                                 | 
                                                            +		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2799
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2799
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2800
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2800
                                                                                                                                                                                                 | 
                                                             		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2801
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2802
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2801
                                                                                                                                                                                                 | 
                                                            +		$sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2802
                                                                                                                                                                                                 | 
                                                            +		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2803
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2803
                                                                                                                                                                                                 | 
                                                             		if (!empty($status)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2804
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= ' AND status = ' . (int) $status;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2804
                                                                                                                                                                                                 | 
                                                            +			$sql .= ' AND status = '.(int) $status;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2805
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2805
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2806
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2806
                                                                                                                                                                                                 | 
                                                             		if (!empty($type)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2807
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= ' AND bomtype = ' . (int) $type;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2807
                                                                                                                                                                                                 | 
                                                            +			$sql .= ' AND bomtype = '.(int) $type;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2808
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2808
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2809
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2809
                                                                                                                                                                                                 | 
                                                             		if (!empty($TProducts)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2810
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2810
                                                                                                                                                                                                 | 
                                                            +			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2811
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2811
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2812
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2812
                                                                                                                                                                                                 | 
                                                             		if (!empty($limit)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2813
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= ' LIMIT ' . (int) $limit;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2813
                                                                                                                                                                                                 | 
                                                            +			$sql .= ' LIMIT '.(int) $limit;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2814
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2814
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2815
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2815
                                                                                                                                                                                                 | 
                                                             		$resql = $db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2816
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2816
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2824,11 +2824,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2824
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2824
                                                                                                                                                                                                 | 
                                                             			while ($obj = $db->fetch_object($resql)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2825
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2825
                                                                                                                                                                                                 | 
                                                             				$product = new Product($db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2826
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2826
                                                                                                                                                                                                 | 
                                                             				$res = $product->fetch($obj->fk_product);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2827
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="' . $obj->rowid . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2827
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="'.$obj->rowid.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2828
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2828
                                                                                                                                                                                                 | 
                                                             				if ($obj->rowid == $selected) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2829
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2829
                                                                                                                                                                                                 | 
                                                             					$out .= 'selected';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2830
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2830
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2831
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2831
                                                                                                                                                                                                 | 
                                                            +				$out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2832
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2832
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2833
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2833
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2834
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2834
                                                                                                                                                                                                 | 
                                                             			$error++;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2885,7 +2885,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2885
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2885
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2886
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2886
                                                                                                                                                                                                 | 
                                                             		$warehouseStatusArray = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2887
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2887
                                                                                                                                                                                                 | 
                                                             		if (!empty($warehouseStatus)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2888
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2888
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2889
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2889
                                                                                                                                                                                                 | 
                                                             			if (preg_match('/warehouseclosed/', $warehouseStatus)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2890
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2890
                                                                                                                                                                                                 | 
                                                             				$warehouseStatusArray[] = Entrepot::STATUS_CLOSED;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2891
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2891
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2899,9 +2899,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2899
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2899
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2900
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2900
                                                                                                                                                                                                 | 
                                                             		$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";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2901
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2901
                                                                                                                                                                                                 | 
                                                             		if (count($warehouseStatusArray)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2902
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$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 | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2902
                                                                                                                                                                                                 | 
                                                            +			$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 | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2903
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2903
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2904
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2904
                                                                                                                                                                                                 | 
                                                            +			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2905
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2905
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2906
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2906
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2907
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2907
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT ";  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2917,9 +2917,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2917
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2917
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2918
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2918
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2919
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2919
                                                                                                                                                                                                 | 
                                                             			//Product category  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2920
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2921
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						FROM " . $this->db->prefix() . "categorie_product  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2922
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2920
                                                                                                                                                                                                 | 
                                                            +			$sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2921
                                                                                                                                                                                                 | 
                                                            +						FROM " . $this->db->prefix()."categorie_product  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2922
                                                                                                                                                                                                 | 
                                                            +						WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2923
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2923
                                                                                                                                                                                                 | 
                                                             						LIMIT 1  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2924
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2924
                                                                                                                                                                                                 | 
                                                             				) AS categorie_product_id ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2925
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2925
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2945,15 +2945,15 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2945
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2945
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2946
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2946
                                                                                                                                                                                                 | 
                                                             		// Price by quantity  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2947
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2947
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2948
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2948
                                                                                                                                                                                                 | 
                                                            +			$sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2949
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2949
                                                                                                                                                                                                 | 
                                                             			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2950
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2950
                                                                                                                                                                                                 | 
                                                            +				$sql .= " AND price_level = ".((int) $price_level);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2951
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2951
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2952
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2952
                                                                                                                                                                                                 | 
                                                             			$sql .= " ORDER BY date_price";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2953
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2953
                                                                                                                                                                                                 | 
                                                             			$sql .= " DESC LIMIT 1) as price_rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2954
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$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  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2954
                                                                                                                                                                                                 | 
                                                            +			$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  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2955
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2955
                                                                                                                                                                                                 | 
                                                             			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2956
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2956
                                                                                                                                                                                                 | 
                                                            +				$sql .= " AND price_level = ".((int) $price_level);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2957
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2957
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2958
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2958
                                                                                                                                                                                                 | 
                                                             			$sql .= " ORDER BY date_price";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2959
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2959
                                                                                                                                                                                                 | 
                                                             			$sql .= " DESC LIMIT 1) as price_by_qty";  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2963,7 +2963,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2963
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2963
                                                                                                                                                                                                 | 
                                                             		$sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2964
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2964
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2965
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2965
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2966
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2966
                                                                                                                                                                                                 | 
                                                            +			$sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2967
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2967
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2968
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2968
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2969
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2969
                                                                                                                                                                                                 | 
                                                             		// Add from (left join) from hooks  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -2972,53 +2972,53 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    2972
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2972
                                                                                                                                                                                                 | 
                                                             		$sql .= $hookmanager->resPrint;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2973
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2973
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2974
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2974
                                                                                                                                                                                                 | 
                                                             		if (count($warehouseStatusArray)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2975
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2976
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2977
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$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. | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2975
                                                                                                                                                                                                 | 
                                                            +			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2976
                                                                                                                                                                                                 | 
                                                            +			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2977
                                                                                                                                                                                                 | 
                                                            +			$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. | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2978
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2978
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2979
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2979
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2980
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2980
                                                                                                                                                                                                 | 
                                                             		// include search in supplier ref  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2981
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2981
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2982
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2982
                                                                                                                                                                                                 | 
                                                            +			$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2983
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2983
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2984
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2984
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2985
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2985
                                                                                                                                                                                                 | 
                                                             		//Price by customer  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2986
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2986
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2987
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " LEFT JOIN  " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2987
                                                                                                                                                                                                 | 
                                                            +			$sql .= " LEFT JOIN  ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2988
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2988
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2989
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2989
                                                                                                                                                                                                 | 
                                                             		// Units  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2990
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2990
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2991
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2991
                                                                                                                                                                                                 | 
                                                            +			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2992
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2992
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2993
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2993
                                                                                                                                                                                                 | 
                                                             		// Multilang : we add translation  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2994
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2994
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2995
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2995
                                                                                                                                                                                                 | 
                                                            +			$sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2996
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2996
                                                                                                                                                                                                 | 
                                                             			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2997
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    2997
                                                                                                                                                                                                 | 
                                                            +				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2998
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2998
                                                                                                                                                                                                 | 
                                                             				$soc = new Societe($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    2999
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    2999
                                                                                                                                                                                                 | 
                                                             				$result = $soc->fetch($socid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3000
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3000
                                                                                                                                                                                                 | 
                                                             				if ($result > 0 && !empty($soc->default_lang)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3001
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3001
                                                                                                                                                                                                 | 
                                                            +					$sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3002
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3002
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3003
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3003
                                                                                                                                                                                                 | 
                                                            +					$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3004
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3004
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3005
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3005
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3006
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3006
                                                                                                                                                                                                 | 
                                                            +				$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3007
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3007
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3008
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3008
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3009
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3009
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3010
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3010
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3011
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3011
                                                                                                                                                                                                 | 
                                                            +			$sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3012
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3012
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3013
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3013
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3014
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3014
                                                                                                                                                                                                 | 
                                                            +		$sql .= ' WHERE p.entity IN ('.getEntity('product').')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3015
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3015
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3016
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3016
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3017
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3017
                                                                                                                                                                                                 | 
                                                             			$sql .= " AND pac.rowid IS NULL";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3018
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3018
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3019
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3019
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3020
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3020
                                                                                                                                                                                                 | 
                                                             		if ($finished == 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3021
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND p.finished = " . ((int) $finished);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3021
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND p.finished = ".((int) $finished);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3022
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3022
                                                                                                                                                                                                 | 
                                                             		} elseif ($finished == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3023
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3023
                                                                                                                                                                                                 | 
                                                             			$sql .= " AND p.finished = ".((int) $finished);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3024
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3024
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3026,11 +3026,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3026
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3026
                                                                                                                                                                                                 | 
                                                             			$sql .= " AND p.tosell = ".((int) $status);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3027
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3027
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3028
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3028
                                                                                                                                                                                                 | 
                                                             		if ($status_purchase >= 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3029
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND p.tobuy = " . ((int) $status_purchase);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3029
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND p.tobuy = ".((int) $status_purchase);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3030
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3030
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3031
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3031
                                                                                                                                                                                                 | 
                                                             		// Filter by product type  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3032
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3032
                                                                                                                                                                                                 | 
                                                             		if (strval($filtertype) != '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3033
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3033
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND p.fk_product_type = ".((int) $filtertype);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3034
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3034
                                                                                                                                                                                                 | 
                                                             		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3035
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3035
                                                                                                                                                                                                 | 
                                                             			$sql .= " AND p.fk_product_type = 1";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3036
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3036
                                                                                                                                                                                                 | 
                                                             		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3054,21 +3054,21 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3054
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3054
                                                                                                                                                                                                 | 
                                                             				if ($i > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3055
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3055
                                                                                                                                                                                                 | 
                                                             					$sql .= " AND ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3056
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3056
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3057
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3057
                                                                                                                                                                                                 | 
                                                            +				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3058
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3058
                                                                                                                                                                                                 | 
                                                             				if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3059
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3059
                                                                                                                                                                                                 | 
                                                            +					$sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3060
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3060
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3061
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3061
                                                                                                                                                                                                 | 
                                                             				if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3062
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3062
                                                                                                                                                                                                 | 
                                                            +					$sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3063
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3063
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3064
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3064
                                                                                                                                                                                                 | 
                                                             				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3065
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3065
                                                                                                                                                                                                 | 
                                                            +					$sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3066
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3066
                                                                                                                                                                                                 | 
                                                             					if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3067
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3067
                                                                                                                                                                                                 | 
                                                            +						$sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3068
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3068
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3069
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3069
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3070
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3070
                                                                                                                                                                                                 | 
                                                             				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3071
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3071
                                                                                                                                                                                                 | 
                                                            +					$sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3072
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3072
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3073
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3073
                                                                                                                                                                                                 | 
                                                             				$sql .= ")";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3074
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3074
                                                                                                                                                                                                 | 
                                                             				$i++;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3077,12 +3077,12 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3077
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3077
                                                                                                                                                                                                 | 
                                                             				$sql .= ")";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3078
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3078
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3079
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3079
                                                                                                                                                                                                 | 
                                                             			if (isModEnabled('barcode')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3080
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3080
                                                                                                                                                                                                 | 
                                                            +				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3081
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3081
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3082
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3082
                                                                                                                                                                                                 | 
                                                             			$sql .= ')';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3083
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3083
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3084
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3084
                                                                                                                                                                                                 | 
                                                             		if (count($warehouseStatusArray)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3085
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " GROUP BY " . $selectFields;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3085
                                                                                                                                                                                                 | 
                                                            +			$sql .= " GROUP BY ".$selectFields;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3086
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3086
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3087
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3087
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3088
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3088
                                                                                                                                                                                                 | 
                                                             		//Sort by category  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3097,23 +3097,23 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3097
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3097
                                                                                                                                                                                                 | 
                                                             		$sql .= $this->db->plimit($limit, 0);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3098
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3098
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3099
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3099
                                                                                                                                                                                                 | 
                                                             		// Build output string  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3100
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3100
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3101
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3101
                                                                                                                                                                                                 | 
                                                             		$result = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3102
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3102
                                                                                                                                                                                                 | 
                                                             		if ($result) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3103
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3104
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3105
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3103
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3104
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3105
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3106
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3106
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3107
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3107
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3108
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3108
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3109
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3109
                                                                                                                                                                                                 | 
                                                             			$events = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3110
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3110
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3111
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3111
                                                                                                                                                                                                 | 
                                                             			if (!$forcecombo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3112
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3112
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3113
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3113
                                                                                                                                                                                                 | 
                                                             				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3114
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3114
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3115
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3115
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3116
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3116
                                                                                                                                                                                                 | 
                                                            +			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3117
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3117
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3118
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3118
                                                                                                                                                                                                 | 
                                                             			$textifempty = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3119
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3119
                                                                                                                                                                                                 | 
                                                             			// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3130,7 +3130,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3130
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3130
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3131
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3131
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3132
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3132
                                                                                                                                                                                                 | 
                                                             			if ($showempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3133
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3133
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3134
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3134
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3135
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3135
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3136
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3136
                                                                                                                                                                                                 | 
                                                             			$i = 0;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3141,11 +3141,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3141
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3141
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3142
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3142
                                                                                                                                                                                                 | 
                                                             				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 | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3143
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3143
                                                                                                                                                                                                 | 
                                                             					$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3144
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3145
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3144
                                                                                                                                                                                                 | 
                                                            +					$sql .= " FROM ".$this->db->prefix()."product_price_by_qty";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3145
                                                                                                                                                                                                 | 
                                                            +					$sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3146
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3146
                                                                                                                                                                                                 | 
                                                             					$sql .= " ORDER BY quantity ASC";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3147
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3147
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3148
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3148
                                                                                                                                                                                                 | 
                                                            +					dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3149
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3149
                                                                                                                                                                                                 | 
                                                             					$result2 = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3150
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3150
                                                                                                                                                                                                 | 
                                                             					if ($result2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3151
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3151
                                                                                                                                                                                                 | 
                                                             						$nb_prices = $this->db->num_rows($result2);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3183,7 +3183,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3183
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3183
                                                                                                                                                                                                 | 
                                                             						$price_product = new Product($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3184
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3184
                                                                                                                                                                                                 | 
                                                             						$price_product->fetch($objp->rowid, '', '', 1);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3185
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3185
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3186
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3186
                                                                                                                                                                                                 | 
                                                            +						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3187
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3187
                                                                                                                                                                                                 | 
                                                             						$priceparser = new PriceParser($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3188
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3188
                                                                                                                                                                                                 | 
                                                             						$price_result = $priceparser->parseProduct($price_product);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3189
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3189
                                                                                                                                                                                                 | 
                                                             						if ($price_result >= 0) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3267,7 +3267,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3267
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3267
                                                                                                                                                                                                 | 
                                                             			$label = $objp->label_translated;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3268
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3268
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3269
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3269
                                                                                                                                                                                                 | 
                                                             		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3270
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3270
                                                                                                                                                                                                 | 
                                                            +			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3271
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3271
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3272
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3272
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3273
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3273
                                                                                                                                                                                                 | 
                                                             		$outkey = $objp->rowid;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3288,32 +3288,32 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3288
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3288
                                                                                                                                                                                                 | 
                                                             		$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3289
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3289
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3290
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3290
                                                                                                                                                                                                 | 
                                                             		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3291
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3291
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3292
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3292
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3293
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3293
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3294
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3294
                                                                                                                                                                                                 | 
                                                             		// Units  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3295
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3295
                                                                                                                                                                                                 | 
                                                             		$outvalUnits = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3296
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3296
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3297
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3297
                                                                                                                                                                                                 | 
                                                             			if (!empty($objp->unit_short)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3298
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$outvalUnits .= ' - ' . $objp->unit_short;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3298
                                                                                                                                                                                                 | 
                                                            +				$outvalUnits .= ' - '.$objp->unit_short;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3299
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3299
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3300
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3300
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3301
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3301
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3302
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3302
                                                                                                                                                                                                 | 
                                                             			if (!empty($objp->weight) && $objp->weight_units !== null) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3303
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3303
                                                                                                                                                                                                 | 
                                                             				$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3304
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$outvalUnits .= ' - ' . $unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3304
                                                                                                                                                                                                 | 
                                                            +				$outvalUnits .= ' - '.$unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3305
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3305
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3306
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3306
                                                                                                                                                                                                 | 
                                                             			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3307
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3308
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$outvalUnits .= ' - ' . $unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3307
                                                                                                                                                                                                 | 
                                                            +				$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3308
                                                                                                                                                                                                 | 
                                                            +				$outvalUnits .= ' - '.$unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3309
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3309
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3310
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3310
                                                                                                                                                                                                 | 
                                                             			if (!empty($objp->surface) && $objp->surface_units !== null) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3311
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3311
                                                                                                                                                                                                 | 
                                                             				$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3312
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$outvalUnits .= ' - ' . $unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3312
                                                                                                                                                                                                 | 
                                                            +				$outvalUnits .= ' - '.$unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3313
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3313
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3314
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3314
                                                                                                                                                                                                 | 
                                                             			if (!empty($objp->volume) && $objp->volume_units !== null) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3315
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3315
                                                                                                                                                                                                 | 
                                                             				$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3316
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$outvalUnits .= ' - ' . $unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3316
                                                                                                                                                                                                 | 
                                                            +				$outvalUnits .= ' - '.$unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3317
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3317
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3318
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3318
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3319
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3319
                                                                                                                                                                                                 | 
                                                             		if ($outdurationvalue && $outdurationunit) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3325,14 +3325,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3325
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3325
                                                                                                                                                                                                 | 
                                                             				'y' => $langs->trans('Year') | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3326
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3326
                                                                                                                                                                                                 | 
                                                             			);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3327
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3327
                                                                                                                                                                                                 | 
                                                             			if (isset($da[$outdurationunit])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3328
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3328
                                                                                                                                                                                                 | 
                                                            +				$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3329
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3329
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3330
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3330
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3331
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3331
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3332
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$opt = '<option value="' . $objp->rowid . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3332
                                                                                                                                                                                                 | 
                                                            +		$opt = '<option value="'.$objp->rowid.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3333
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3333
                                                                                                                                                                                                 | 
                                                             		$opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3334
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3334
                                                                                                                                                                                                 | 
                                                             		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3335
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$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 . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3335
                                                                                                                                                                                                 | 
                                                            +			$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.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3336
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3336
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3337
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3337
                                                                                                                                                                                                 | 
                                                             		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3338
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3338
                                                                                                                                                                                                 | 
                                                             			if ($user->hasRight('stock', 'lire')) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3344,36 +3344,36 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3344
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3344
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3345
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3345
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3346
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3346
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3347
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$opt .= ' data-labeltrans="' . $outlabel_translated . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3348
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3347
                                                                                                                                                                                                 | 
                                                            +			$opt .= ' data-labeltrans="'.$outlabel_translated.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3348
                                                                                                                                                                                                 | 
                                                            +			$opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3349
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3349
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3350
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3350
                                                                                                                                                                                                 | 
                                                             		$opt .= '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3351
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3351
                                                                                                                                                                                                 | 
                                                             		$opt .= $objp->ref;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3352
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3352
                                                                                                                                                                                                 | 
                                                             		if (!empty($objp->custref)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3353
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$opt .= ' (' . $objp->custref . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3353
                                                                                                                                                                                                 | 
                                                            +			$opt .= ' ('.$objp->custref.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3354
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3354
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3355
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3355
                                                                                                                                                                                                 | 
                                                             		if ($outbarcode) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3356
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$opt .= ' (' . $outbarcode . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3356
                                                                                                                                                                                                 | 
                                                            +			$opt .= ' ('.$outbarcode.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3357
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3357
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3358
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$opt .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3358
                                                                                                                                                                                                 | 
                                                            +		$opt .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3359
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3359
                                                                                                                                                                                                 | 
                                                             		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3360
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$opt .= ' (' . getCountry($outorigin, 1) . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3360
                                                                                                                                                                                                 | 
                                                            +			$opt .= ' ('.getCountry($outorigin, 1).')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3361
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3361
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3362
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3362
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3363
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3363
                                                                                                                                                                                                 | 
                                                             		$objRef = $objp->ref;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3364
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3364
                                                                                                                                                                                                 | 
                                                             		if (!empty($objp->custref)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3365
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$objRef .= ' (' . $objp->custref . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3365
                                                                                                                                                                                                 | 
                                                            +			$objRef .= ' ('.$objp->custref.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3366
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3366
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3367
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3367
                                                                                                                                                                                                 | 
                                                             		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3368
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3368
                                                                                                                                                                                                 | 
                                                            +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3369
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3369
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3370
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3370
                                                                                                                                                                                                 | 
                                                             		$outval .= $objRef;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3371
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3371
                                                                                                                                                                                                 | 
                                                             		if ($outbarcode) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3372
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$outval .= ' (' . $outbarcode . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3372
                                                                                                                                                                                                 | 
                                                            +			$outval .= ' ('.$outbarcode.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3373
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3373
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3374
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$outval .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3374
                                                                                                                                                                                                 | 
                                                            +		$outval .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3375
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3375
                                                                                                                                                                                                 | 
                                                             		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3376
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$outval .= ' (' . getCountry($outorigin, 1) . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3376
                                                                                                                                                                                                 | 
                                                            +			$outval .= ' ('.getCountry($outorigin, 1).')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3377
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3377
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3378
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3378
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3379
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3379
                                                                                                                                                                                                 | 
                                                             		// Units  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3386,35 +3386,35 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3386
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3386
                                                                                                                                                                                                 | 
                                                             		// If we need a particular price level (from 1 to n)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3387
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3387
                                                                                                                                                                                                 | 
                                                             		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3388
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3388
                                                                                                                                                                                                 | 
                                                             			$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3389
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " FROM " . $this->db->prefix() . "product_price";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3390
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " WHERE fk_product = " . ((int) $objp->rowid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3391
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND entity IN (" . getEntity('productprice') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3392
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3389
                                                                                                                                                                                                 | 
                                                            +			$sql .= " FROM ".$this->db->prefix()."product_price";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3390
                                                                                                                                                                                                 | 
                                                            +			$sql .= " WHERE fk_product = ".((int) $objp->rowid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3391
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND entity IN (".getEntity('productprice').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3392
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND price_level = ".((int) $price_level);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3393
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3393
                                                                                                                                                                                                 | 
                                                             			$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3394
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3394
                                                                                                                                                                                                 | 
                                                             			$sql .= " LIMIT 1";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3395
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3395
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3396
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3396
                                                                                                                                                                                                 | 
                                                            +			dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3397
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3397
                                                                                                                                                                                                 | 
                                                             			$result2 = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3398
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3398
                                                                                                                                                                                                 | 
                                                             			if ($result2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3399
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3399
                                                                                                                                                                                                 | 
                                                             				$objp2 = $this->db->fetch_object($result2);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3400
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3400
                                                                                                                                                                                                 | 
                                                             				if ($objp2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3401
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3401
                                                                                                                                                                                                 | 
                                                             					$found = 1;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3402
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3402
                                                                                                                                                                                                 | 
                                                             					if ($objp2->price_base_type == 'HT') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3403
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$opt .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3404
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outval .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3403
                                                                                                                                                                                                 | 
                                                            +						$opt .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3404
                                                                                                                                                                                                 | 
                                                            +						$outval .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3405
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3405
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3406
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$opt .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3407
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outval .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3406
                                                                                                                                                                                                 | 
                                                            +						$opt .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3407
                                                                                                                                                                                                 | 
                                                            +						$outval .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3408
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3408
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3409
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3409
                                                                                                                                                                                                 | 
                                                             					$outprice_ht = price($objp2->price);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3410
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3410
                                                                                                                                                                                                 | 
                                                             					$outprice_ttc = price($objp2->price_ttc);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3411
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3411
                                                                                                                                                                                                 | 
                                                             					$outpricebasetype = $objp2->price_base_type;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3412
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3412
                                                                                                                                                                                                 | 
                                                             					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3413
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outtva_tx = $objp2->tva_tx;                        // We use the vat rate on line of multiprice  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3414
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outdefault_vat_code = $objp2->default_vat_code;    // We use the vat code on line of multiprice  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3413
                                                                                                                                                                                                 | 
                                                            +						$outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3414
                                                                                                                                                                                                 | 
                                                            +						$outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3415
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3415
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3416
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outtva_tx = $objp->tva_tx;                            // We use the vat rate of product, not the one on line of multiprice  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3417
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outdefault_vat_code = $objp->default_vat_code;        // We use the vat code or product, not the one on line of multiprice  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3416
                                                                                                                                                                                                 | 
                                                            +						$outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3417
                                                                                                                                                                                                 | 
                                                            +						$outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3418
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3418
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3419
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3419
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3420
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3420
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3428,13 +3428,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3428
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3428
                                                                                                                                                                                                 | 
                                                             			$outqty = $objp->quantity;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3429
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3429
                                                                                                                                                                                                 | 
                                                             			$outdiscount = $objp->remise_percent;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3430
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3430
                                                                                                                                                                                                 | 
                                                             			if ($objp->quantity == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3431
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$opt .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3432
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$outval .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3431
                                                                                                                                                                                                 | 
                                                            +				$opt .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3432
                                                                                                                                                                                                 | 
                                                            +				$outval .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3433
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3433
                                                                                                                                                                                                 | 
                                                             				$opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3434
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3434
                                                                                                                                                                                                 | 
                                                             				$outval .= $langs->transnoentities("Unit"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3435
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3435
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3436
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3437
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3436
                                                                                                                                                                                                 | 
                                                            +				$opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3437
                                                                                                                                                                                                 | 
                                                            +				$outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3438
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3438
                                                                                                                                                                                                 | 
                                                             				$opt .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3439
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3439
                                                                                                                                                                                                 | 
                                                             				$outval .= $langs->transnoentities("Units"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3440
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3440
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3442,16 +3442,16 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3442
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3442
                                                                                                                                                                                                 | 
                                                             			$outprice_ht = price($objp->unitprice);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3443
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3443
                                                                                                                                                                                                 | 
                                                             			$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3444
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3444
                                                                                                                                                                                                 | 
                                                             			$outpricebasetype = $objp->price_base_type;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3445
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$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  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3446
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$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  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3445
                                                                                                                                                                                                 | 
                                                            +			$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  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3446
                                                                                                                                                                                                 | 
                                                            +			$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  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3447
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3447
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3448
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3448
                                                                                                                                                                                                 | 
                                                             		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3449
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$opt .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3450
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$outval .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3449
                                                                                                                                                                                                 | 
                                                            +			$opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3450
                                                                                                                                                                                                 | 
                                                            +			$outval .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3451
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3451
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3452
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3452
                                                                                                                                                                                                 | 
                                                             		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3453
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$opt .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3454
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$outval .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3453
                                                                                                                                                                                                 | 
                                                            +			$opt .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3454
                                                                                                                                                                                                 | 
                                                            +			$outval .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3455
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3455
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3456
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3456
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3457
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3457
                                                                                                                                                                                                 | 
                                                             		// Price by customer  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3460,11 +3460,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3460
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3460
                                                                                                                                                                                                 | 
                                                             				$found = 1;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3461
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3461
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3462
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3462
                                                                                                                                                                                                 | 
                                                             				if ($objp->custprice_base_type == 'HT') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3463
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$opt .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3464
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$outval .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3463
                                                                                                                                                                                                 | 
                                                            +					$opt .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3464
                                                                                                                                                                                                 | 
                                                            +					$outval .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3465
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3465
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3466
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$opt .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3467
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$outval .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3466
                                                                                                                                                                                                 | 
                                                            +					$opt .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3467
                                                                                                                                                                                                 | 
                                                            +					$outval .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3468
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3468
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3469
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3469
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3470
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3470
                                                                                                                                                                                                 | 
                                                             				$outprice_ht = price($objp->custprice);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3478,11 +3478,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3478
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3478
                                                                                                                                                                                                 | 
                                                             		// If level no defined or multiprice not found, we used the default price  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3479
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3479
                                                                                                                                                                                                 | 
                                                             		if (empty($hidepriceinlabel) && !$found) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3480
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3480
                                                                                                                                                                                                 | 
                                                             			if ($objp->price_base_type == 'HT') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3481
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3482
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3481
                                                                                                                                                                                                 | 
                                                            +				$opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3482
                                                                                                                                                                                                 | 
                                                            +				$outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3483
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3483
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3484
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$opt .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3485
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$outval .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3484
                                                                                                                                                                                                 | 
                                                            +				$opt .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3485
                                                                                                                                                                                                 | 
                                                            +				$outval .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3486
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3486
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3487
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3487
                                                                                                                                                                                                 | 
                                                             			$outprice_ht = price($objp->price);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3488
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3488
                                                                                                                                                                                                 | 
                                                             			$outprice_ttc = price($objp->price_ttc);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3493,14 +3493,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3493
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3493
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3494
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3494
                                                                                                                                                                                                 | 
                                                             		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3495
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3495
                                                                                                                                                                                                 | 
                                                             			if ($user->hasRight('stock', 'lire')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3496
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$opt .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3496
                                                                                                                                                                                                 | 
                                                            +				$opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3497
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3497
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3498
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3498
                                                                                                                                                                                                 | 
                                                             				if ($objp->stock > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3499
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3499
                                                                                                                                                                                                 | 
                                                             					$outval .= ' - <span class="product_line_stock_ok">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3500
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3500
                                                                                                                                                                                                 | 
                                                             				} elseif ($objp->stock <= 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3501
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3501
                                                                                                                                                                                                 | 
                                                             					$outval .= ' - <span class="product_line_stock_too_low">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3502
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3502
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3503
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$outval .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3503
                                                                                                                                                                                                 | 
                                                            +				$outval .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3504
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3504
                                                                                                                                                                                                 | 
                                                             				$outval .= '</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3505
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3505
                                                                                                                                                                                                 | 
                                                             				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3506
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3506
                                                                                                                                                                                                 | 
                                                             					$langs->load("stocks"); | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3510,9 +3510,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3510
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3510
                                                                                                                                                                                                 | 
                                                             					$tmpproduct->load_virtual_stock();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3511
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3511
                                                                                                                                                                                                 | 
                                                             					$virtualstock = $tmpproduct->stock_theorique;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3512
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3512
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3513
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$opt .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3513
                                                                                                                                                                                                 | 
                                                            +					$opt .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3514
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3514
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3515
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$outval .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3515
                                                                                                                                                                                                 | 
                                                            +					$outval .= ' - '.$langs->transnoentities("VirtualStock").':'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3516
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3516
                                                                                                                                                                                                 | 
                                                             					if ($virtualstock > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3517
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3517
                                                                                                                                                                                                 | 
                                                             						$outval .= '<span class="product_line_stock_ok">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3518
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3518
                                                                                                                                                                                                 | 
                                                             					} elseif ($virtualstock <= 0) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3590,7 +3590,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3590
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3590
                                                                                                                                                                                                 | 
                                                             		$selected_input_value = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3591
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3591
                                                                                                                                                                                                 | 
                                                             		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3592
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3592
                                                                                                                                                                                                 | 
                                                             			if ($selected > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3593
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3593
                                                                                                                                                                                                 | 
                                                            +				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3594
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3594
                                                                                                                                                                                                 | 
                                                             				$producttmpselect = new Product($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3595
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3595
                                                                                                                                                                                                 | 
                                                             				$producttmpselect->fetch($selected);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3596
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3596
                                                                                                                                                                                                 | 
                                                             				$selected_input_value = $producttmpselect->ref;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3598,10 +3598,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3598
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3598
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3599
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3599
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3600
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3600
                                                                                                                                                                                                 | 
                                                             			// mode=2 means suppliers products  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3601
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3602
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3601
                                                                                                                                                                                                 | 
                                                            +			$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3602
                                                                                                                                                                                                 | 
                                                            +			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3603
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3603
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3604
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3604
                                                                                                                                                                                                 | 
                                                            +			print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3605
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3605
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3606
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3606
                                                                                                                                                                                                 | 
                                                             			print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3607
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3607
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3661,25 +3661,25 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3661
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3661
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3662
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3662
                                                                                                                                                                                                 | 
                                                             			$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";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3663
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3663
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3664
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "product as p";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3665
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3664
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3665
                                                                                                                                                                                                 | 
                                                            +		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3666
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3666
                                                                                                                                                                                                 | 
                                                             		if ($socid > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3667
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND pfp.fk_soc = " . ((int) $socid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3667
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND pfp.fk_soc = ".((int) $socid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3668
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3668
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3669
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3669
                                                                                                                                                                                                 | 
                                                            +		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3670
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3670
                                                                                                                                                                                                 | 
                                                             		// Units  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3671
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3671
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3672
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3672
                                                                                                                                                                                                 | 
                                                            +			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3673
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3673
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3674
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3674
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE p.entity IN (".getEntity('product').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3675
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3675
                                                                                                                                                                                                 | 
                                                             		if ($statut != -1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3676
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND p.tobuy = " . ((int) $statut);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3676
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND p.tobuy = ".((int) $statut);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3677
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3677
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3678
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3678
                                                                                                                                                                                                 | 
                                                             		if (strval($filtertype) != '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3679
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3679
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND p.fk_product_type = ".((int) $filtertype);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3680
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3680
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3681
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3681
                                                                                                                                                                                                 | 
                                                             		if (!empty($filtre)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3682
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " " . $filtre;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3682
                                                                                                                                                                                                 | 
                                                            +			$sql .= " ".$filtre;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3683
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3683
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3684
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3684
                                                                                                                                                                                                 | 
                                                             		// Add where from hooks  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3685
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3685
                                                                                                                                                                                                 | 
                                                             		$parameters = array();  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3699,9 +3699,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3699
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3699
                                                                                                                                                                                                 | 
                                                             				if ($i > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3700
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3700
                                                                                                                                                                                                 | 
                                                             					$sql .= " AND ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3701
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3701
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3702
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$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) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3702
                                                                                                                                                                                                 | 
                                                            +				$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)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3703
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3703
                                                                                                                                                                                                 | 
                                                             				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3704
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3704
                                                                                                                                                                                                 | 
                                                            +					$sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3705
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3705
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3706
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3706
                                                                                                                                                                                                 | 
                                                             				$sql .= ")";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3707
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3707
                                                                                                                                                                                                 | 
                                                             				$i++;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3710,8 +3710,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3710
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3710
                                                                                                                                                                                                 | 
                                                             				$sql .= ")";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3711
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3711
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3712
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3712
                                                                                                                                                                                                 | 
                                                             			if (isModEnabled('barcode')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3713
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3714
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3713
                                                                                                                                                                                                 | 
                                                            +				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3714
                                                                                                                                                                                                 | 
                                                            +				$sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3715
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3715
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3716
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3716
                                                                                                                                                                                                 | 
                                                             			$sql .= ')';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3717
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3717
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3720,20 +3720,20 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3720
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3720
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3721
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3721
                                                                                                                                                                                                 | 
                                                             		// Build output string  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3722
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3722
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3723
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3723
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3724
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3724
                                                                                                                                                                                                 | 
                                                             		$result = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3725
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3725
                                                                                                                                                                                                 | 
                                                             		if ($result) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3726
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3727
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3726
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3727
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3728
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3728
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3729
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3729
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3730
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3730
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3731
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3731
                                                                                                                                                                                                 | 
                                                             			//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">';	// remove select to have id same with combo and ajax  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3732
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3732
                                                                                                                                                                                                 | 
                                                            +			$out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3733
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3733
                                                                                                                                                                                                 | 
                                                             			if (!$selected) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3734
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3734
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3735
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3735
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3736
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3736
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3737
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3737
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3738
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3738
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3739
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3739
                                                                                                                                                                                                 | 
                                                             			$i = 0;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3748,7 +3748,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3748
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3748
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3749
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3749
                                                                                                                                                                                                 | 
                                                             				$outkey = $objp->idprodfournprice; // id in table of price  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3750
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3750
                                                                                                                                                                                                 | 
                                                             				if (!$outkey && $alsoproductwithnosupplierprice) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3751
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$outkey = 'idprod_' . $objp->rowid; // id of product  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3751
                                                                                                                                                                                                 | 
                                                            +					$outkey = 'idprod_'.$objp->rowid; // id of product  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3752
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3752
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3753
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3753
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3754
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3754
                                                                                                                                                                                                 | 
                                                             				$outref = $objp->ref;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3763,23 +3763,23 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3763
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3763
                                                                                                                                                                                                 | 
                                                             				$outvalUnits = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3764
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3764
                                                                                                                                                                                                 | 
                                                             				if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3765
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3765
                                                                                                                                                                                                 | 
                                                             					if (!empty($objp->unit_short)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3766
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outvalUnits .= ' - ' . $objp->unit_short;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3766
                                                                                                                                                                                                 | 
                                                            +						$outvalUnits .= ' - '.$objp->unit_short;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3767
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3767
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3768
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3768
                                                                                                                                                                                                 | 
                                                             					if (!empty($objp->weight) && $objp->weight_units !== null) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3769
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3769
                                                                                                                                                                                                 | 
                                                             						$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3770
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outvalUnits .= ' - ' . $unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3770
                                                                                                                                                                                                 | 
                                                            +						$outvalUnits .= ' - '.$unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3771
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3771
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3772
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3772
                                                                                                                                                                                                 | 
                                                             					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3773
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3774
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outvalUnits .= ' - ' . $unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3773
                                                                                                                                                                                                 | 
                                                            +						$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3774
                                                                                                                                                                                                 | 
                                                            +						$outvalUnits .= ' - '.$unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3775
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3775
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3776
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3776
                                                                                                                                                                                                 | 
                                                             					if (!empty($objp->surface) && $objp->surface_units !== null) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3777
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3777
                                                                                                                                                                                                 | 
                                                             						$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3778
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outvalUnits .= ' - ' . $unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3778
                                                                                                                                                                                                 | 
                                                            +						$outvalUnits .= ' - '.$unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3779
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3779
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3780
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3780
                                                                                                                                                                                                 | 
                                                             					if (!empty($objp->volume) && $objp->volume_units !== null) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3781
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3781
                                                                                                                                                                                                 | 
                                                             						$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3782
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outvalUnits .= ' - ' . $unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3782
                                                                                                                                                                                                 | 
                                                            +						$outvalUnits .= ' - '.$unitToShow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3783
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3783
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3784
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3784
                                                                                                                                                                                                 | 
                                                             					if ($outdurationvalue && $outdurationunit) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3785
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3785
                                                                                                                                                                                                 | 
                                                             						$da = array(  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3790,22 +3790,22 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3790
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3790
                                                                                                                                                                                                 | 
                                                             							'y' => $langs->trans('Year') | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3791
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3791
                                                                                                                                                                                                 | 
                                                             						);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3792
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3792
                                                                                                                                                                                                 | 
                                                             						if (isset($da[$outdurationunit])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3793
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3793
                                                                                                                                                                                                 | 
                                                            +							$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3794
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3794
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3795
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3795
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3796
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3796
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3797
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3797
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3798
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3798
                                                                                                                                                                                                 | 
                                                             				$objRef = $objp->ref;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3799
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3799
                                                                                                                                                                                                 | 
                                                             				if ($filterkey && $filterkey != '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3800
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3800
                                                                                                                                                                                                 | 
                                                            +					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3801
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3801
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3802
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3802
                                                                                                                                                                                                 | 
                                                             				$objRefFourn = $objp->ref_fourn;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3803
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3803
                                                                                                                                                                                                 | 
                                                             				if ($filterkey && $filterkey != '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3804
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3804
                                                                                                                                                                                                 | 
                                                            +					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3805
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3805
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3806
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3806
                                                                                                                                                                                                 | 
                                                             				$label = $objp->label;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3807
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3807
                                                                                                                                                                                                 | 
                                                             				if ($filterkey && $filterkey != '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3808
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3808
                                                                                                                                                                                                 | 
                                                            +					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3809
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3809
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3810
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3810
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3811
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3811
                                                                                                                                                                                                 | 
                                                             				switch ($objp->fk_product_type) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3828,21 +3828,21 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3828
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3828
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3829
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3829
                                                                                                                                                                                                 | 
                                                             				$optlabel .= $objp->ref;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3830
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3830
                                                                                                                                                                                                 | 
                                                             				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3831
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3831
                                                                                                                                                                                                 | 
                                                            +					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3832
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3832
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3833
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3833
                                                                                                                                                                                                 | 
                                                             				if (isModEnabled('barcode') && !empty($objp->barcode)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3834
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$optlabel .= ' (' . $outbarcode . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3834
                                                                                                                                                                                                 | 
                                                            +					$optlabel .= ' ('.$outbarcode.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3835
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3835
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3836
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3836
                                                                                                                                                                                                 | 
                                                            +				$optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3837
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3837
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3838
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3838
                                                                                                                                                                                                 | 
                                                             				$outvallabel = $objRef;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3839
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3839
                                                                                                                                                                                                 | 
                                                             				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3840
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$outvallabel .= ' (' . $objRefFourn . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3840
                                                                                                                                                                                                 | 
                                                            +					$outvallabel .= ' ('.$objRefFourn.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3841
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3841
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3842
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3842
                                                                                                                                                                                                 | 
                                                             				if (isModEnabled('barcode') && !empty($objp->barcode)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3843
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$outvallabel .= ' (' . $outbarcode . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3843
                                                                                                                                                                                                 | 
                                                            +					$outvallabel .= ' ('.$outbarcode.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3844
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3844
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3845
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3845
                                                                                                                                                                                                 | 
                                                            +				$outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3846
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3846
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3847
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3847
                                                                                                                                                                                                 | 
                                                             				// Units  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3848
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3848
                                                                                                                                                                                                 | 
                                                             				$optlabel .= $outvalUnits;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3859,7 +3859,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3859
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3859
                                                                                                                                                                                                 | 
                                                             						$prod_supplier->fourn_tva_tx = $objp->tva_tx;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3860
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3860
                                                                                                                                                                                                 | 
                                                             						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3861
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3861
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3862
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3862
                                                                                                                                                                                                 | 
                                                            +						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3863
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3863
                                                                                                                                                                                                 | 
                                                             						$priceparser = new PriceParser($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3864
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3864
                                                                                                                                                                                                 | 
                                                             						$price_result = $priceparser->parseProductSupplier($prod_supplier);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3865
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3865
                                                                                                                                                                                                 | 
                                                             						if ($price_result >= 0) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3870,57 +3870,57 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3870
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3870
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3871
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3871
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3872
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3872
                                                                                                                                                                                                 | 
                                                             					if ($objp->quantity == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3873
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3874
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3873
                                                                                                                                                                                                 | 
                                                            +						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3874
                                                                                                                                                                                                 | 
                                                            +						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3875
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3875
                                                                                                                                                                                                 | 
                                                             						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3876
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3876
                                                                                                                                                                                                 | 
                                                             						$outvallabel .= $langs->transnoentities("Unit"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3877
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3877
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3878
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3879
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3880
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3881
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outvallabel .= ' ' . $langs->transnoentities("Units"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3878
                                                                                                                                                                                                 | 
                                                            +						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3879
                                                                                                                                                                                                 | 
                                                            +						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3880
                                                                                                                                                                                                 | 
                                                            +						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3881
                                                                                                                                                                                                 | 
                                                            +						$outvallabel .= ' '.$langs->transnoentities("Units"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3882
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3882
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3883
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3883
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3884
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3884
                                                                                                                                                                                                 | 
                                                             					if ($objp->quantity > 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3885
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$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 | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3886
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$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 | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3885
                                                                                                                                                                                                 | 
                                                            +						$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 | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3886
                                                                                                                                                                                                 | 
                                                            +						$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 | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3887
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3887
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3888
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3888
                                                                                                                                                                                                 | 
                                                             					if ($objp->remise_percent >= 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3889
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3890
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3889
                                                                                                                                                                                                 | 
                                                            +						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3890
                                                                                                                                                                                                 | 
                                                            +						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3891
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3891
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3892
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3892
                                                                                                                                                                                                 | 
                                                             					if ($objp->duration) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3893
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$optlabel .= " - " . $objp->duration;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3894
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outvallabel .= " - " . $objp->duration;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3893
                                                                                                                                                                                                 | 
                                                            +						$optlabel .= " - ".$objp->duration;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3894
                                                                                                                                                                                                 | 
                                                            +						$outvallabel .= " - ".$objp->duration;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3895
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3895
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3896
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3896
                                                                                                                                                                                                 | 
                                                             					if (!$socid) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3897
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$optlabel .= " - " . dol_trunc($objp->name, 8);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3898
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outvallabel .= " - " . dol_trunc($objp->name, 8);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3897
                                                                                                                                                                                                 | 
                                                            +						$optlabel .= " - ".dol_trunc($objp->name, 8);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3898
                                                                                                                                                                                                 | 
                                                            +						$outvallabel .= " - ".dol_trunc($objp->name, 8);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3899
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3899
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3900
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3900
                                                                                                                                                                                                 | 
                                                             					if ($objp->supplier_reputation) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3901
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3901
                                                                                                                                                                                                 | 
                                                             						//TODO dictionary  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3902
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3902
                                                                                                                                                                                                 | 
                                                             						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3903
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3903
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3904
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$optlabel .= " - " . $reputations[$objp->supplier_reputation];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3905
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outvallabel .= " - " . $reputations[$objp->supplier_reputation];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3904
                                                                                                                                                                                                 | 
                                                            +						$optlabel .= " - ".$reputations[$objp->supplier_reputation];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3905
                                                                                                                                                                                                 | 
                                                            +						$outvallabel .= " - ".$reputations[$objp->supplier_reputation];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3906
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3906
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3907
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3907
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3908
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3909
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3908
                                                                                                                                                                                                 | 
                                                            +					$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3909
                                                                                                                                                                                                 | 
                                                            +					$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3910
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3910
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3911
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3911
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3912
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3912
                                                                                                                                                                                                 | 
                                                             				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3913
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3913
                                                                                                                                                                                                 | 
                                                             					$novirtualstock = ($showstockinlist == 2);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3914
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3914
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3915
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3915
                                                                                                                                                                                                 | 
                                                             					if ($user->hasRight('stock', 'lire')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3916
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3916
                                                                                                                                                                                                 | 
                                                            +						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3917
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3917
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3918
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3918
                                                                                                                                                                                                 | 
                                                             						if ($objp->stock > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3919
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3919
                                                                                                                                                                                                 | 
                                                             							$optlabel .= ' - <span class="product_line_stock_ok">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3920
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3920
                                                                                                                                                                                                 | 
                                                             						} elseif ($objp->stock <= 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3921
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3921
                                                                                                                                                                                                 | 
                                                             							$optlabel .= ' - <span class="product_line_stock_too_low">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3922
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3922
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3923
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3923
                                                                                                                                                                                                 | 
                                                            +						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3924
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3924
                                                                                                                                                                                                 | 
                                                             						$optlabel .= '</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3925
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3925
                                                                                                                                                                                                 | 
                                                             						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3926
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3926
                                                                                                                                                                                                 | 
                                                             							$langs->load("stocks"); | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3930,9 +3930,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3930
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3930
                                                                                                                                                                                                 | 
                                                             							$tmpproduct->load_virtual_stock();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3931
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3931
                                                                                                                                                                                                 | 
                                                             							$virtualstock = $tmpproduct->stock_theorique;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3932
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3932
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3933
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3933
                                                                                                                                                                                                 | 
                                                            +							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3934
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3934
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3935
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3935
                                                                                                                                                                                                 | 
                                                            +							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3936
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3936
                                                                                                                                                                                                 | 
                                                             							if ($virtualstock > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3937
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3937
                                                                                                                                                                                                 | 
                                                             								$optlabel .= '<span class="product_line_stock_ok">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3938
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3938
                                                                                                                                                                                                 | 
                                                             							} elseif ($virtualstock <= 0) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3946,7 +3946,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3946
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3946
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3947
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3947
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3948
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3948
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3949
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$optstart = '<option value="' . $outkey . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3949
                                                                                                                                                                                                 | 
                                                            +				$optstart = '<option value="'.$outkey.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3950
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3950
                                                                                                                                                                                                 | 
                                                             				if ($selected && $selected == $objp->idprodfournprice) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3951
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3951
                                                                                                                                                                                                 | 
                                                             					$optstart .= ' selected';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3952
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3952
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -3955,31 +3955,31 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    3955
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3955
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3956
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3956
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3957
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3957
                                                                                                                                                                                                 | 
                                                             				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3958
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3959
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3960
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3961
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3962
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3963
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3964
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3965
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3966
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3967
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3958
                                                                                                                                                                                                 | 
                                                            +					$optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3959
                                                                                                                                                                                                 | 
                                                            +					$optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3960
                                                                                                                                                                                                 | 
                                                            +					$optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3961
                                                                                                                                                                                                 | 
                                                            +					$optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3962
                                                                                                                                                                                                 | 
                                                            +					$optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3963
                                                                                                                                                                                                 | 
                                                            +					$optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3964
                                                                                                                                                                                                 | 
                                                            +					$optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3965
                                                                                                                                                                                                 | 
                                                            +					$optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3966
                                                                                                                                                                                                 | 
                                                            +					$optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3967
                                                                                                                                                                                                 | 
                                                            +					$optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3968
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3968
                                                                                                                                                                                                 | 
                                                             					if (isModEnabled('multicurrency')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3969
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3970
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3969
                                                                                                                                                                                                 | 
                                                            +						$optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3970
                                                                                                                                                                                                 | 
                                                            +						$optstart .= ' data-multicurrency-up="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3971
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3971
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3972
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3972
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3973
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3973
                                                                                                                                                                                                 | 
                                                            +				$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3974
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3974
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3975
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3975
                                                                                                                                                                                                 | 
                                                             				$outarrayentry = array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3976
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3976
                                                                                                                                                                                                 | 
                                                             					'key' => $outkey,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3977
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3977
                                                                                                                                                                                                 | 
                                                             					'value' => $outref,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3978
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3978
                                                                                                                                                                                                 | 
                                                             					'label' => $outvallabel,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3979
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3979
                                                                                                                                                                                                 | 
                                                             					'qty' => $outqty,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3980
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'price_qty_ht' => price2num($objp->fprice, 'MU'),    // Keep higher resolution for price for the min qty  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3981
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3982
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3980
                                                                                                                                                                                                 | 
                                                            +					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3981
                                                                                                                                                                                                 | 
                                                            +					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    3982
                                                                                                                                                                                                 | 
                                                            +					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3983
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3983
                                                                                                                                                                                                 | 
                                                             					'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3984
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3984
                                                                                                                                                                                                 | 
                                                             					'tva_tx' => price2num($objp->tva_tx),  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    3985
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    3985
                                                                                                                                                                                                 | 
                                                             					'default_vat_code' => $objp->default_vat_code,  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4009,17 +4009,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4009
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4009
                                                                                                                                                                                                 | 
                                                             				// Add new entry  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4010
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4010
                                                                                                                                                                                                 | 
                                                             				// "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  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4011
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4011
                                                                                                                                                                                                 | 
                                                             				// "label" value of json key array is used by jQuery automatically as text for combo box  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4012
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4012
                                                                                                                                                                                                 | 
                                                            +				$out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4013
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4013
                                                                                                                                                                                                 | 
                                                             				$outarraypush = array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4014
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4014
                                                                                                                                                                                                 | 
                                                             					'key' => $outkey,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4015
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4015
                                                                                                                                                                                                 | 
                                                             					'value' => $outref,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4016
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4016
                                                                                                                                                                                                 | 
                                                             					'label' => $outvallabel,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4017
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4017
                                                                                                                                                                                                 | 
                                                             					'qty' => $outqty,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4018
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'price_qty_ht' => price2num($objp->fprice, 'MU'),        // Keep higher resolution for price for the min qty  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4018
                                                                                                                                                                                                 | 
                                                            +					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4019
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4019
                                                                                                                                                                                                 | 
                                                             					'price_qty_ht_locale' => price($objp->fprice),  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4020
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4020
                                                                                                                                                                                                 | 
                                                            +					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4021
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4021
                                                                                                                                                                                                 | 
                                                             					'price_unit_ht_locale' => price($objp->unitprice),  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4022
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4022
                                                                                                                                                                                                 | 
                                                            +					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4023
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4023
                                                                                                                                                                                                 | 
                                                             					'tva_tx_formated' => price($objp->tva_tx),  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4024
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4024
                                                                                                                                                                                                 | 
                                                             					'tva_tx' => price2num($objp->tva_tx),  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4025
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4025
                                                                                                                                                                                                 | 
                                                             					'default_vat_code' => $objp->default_vat_code,  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4052,7 +4052,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4052
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4052
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4053
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4053
                                                                                                                                                                                                 | 
                                                             			$this->db->free($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4054
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4054
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4055
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4055
                                                                                                                                                                                                 | 
                                                            +			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4056
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4056
                                                                                                                                                                                                 | 
                                                             			$out .= ajax_combobox($htmlname);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4057
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4057
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4058
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4058
                                                                                                                                                                                                 | 
                                                             			dol_print_error($this->db);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4084,43 +4084,43 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4084
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4084
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4085
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4085
                                                                                                                                                                                                 | 
                                                             		$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4086
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4086
                                                                                                                                                                                                 | 
                                                             		$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4087
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "product as p";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4088
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4089
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4090
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4087
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4088
                                                                                                                                                                                                 | 
                                                            +		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4089
                                                                                                                                                                                                 | 
                                                            +		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4090
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4091
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4091
                                                                                                                                                                                                 | 
                                                             		$sql .= " AND p.tobuy = 1";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4092
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4092
                                                                                                                                                                                                 | 
                                                             		$sql .= " AND s.fournisseur = 1";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4093
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " AND p.rowid = " . ((int) $productid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4093
                                                                                                                                                                                                 | 
                                                            +		$sql .= " AND p.rowid = ".((int) $productid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4094
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4094
                                                                                                                                                                                                 | 
                                                             		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4095
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4095
                                                                                                                                                                                                 | 
                                                             			$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4096
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4096
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4097
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4097
                                                                                                                                                                                                 | 
                                                             			$sql .= " ORDER BY pfp.unitprice ASC";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4098
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4098
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4099
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4099
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4100
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4100
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4101
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4101
                                                                                                                                                                                                 | 
                                                             		$result = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4102
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4102
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4103
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4103
                                                                                                                                                                                                 | 
                                                             		if ($result) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4104
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4104
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4105
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4105
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4106
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4106
                                                                                                                                                                                                 | 
                                                            +			$form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4107
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4107
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4108
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4108
                                                                                                                                                                                                 | 
                                                             			if (!$num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4109
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4109
                                                                                                                                                                                                 | 
                                                            +				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4110
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4110
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4111
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4111
                                                                                                                                                                                                 | 
                                                            +				require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4112
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4112
                                                                                                                                                                                                 | 
                                                             				$form .= '<option value="0"> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4113
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4113
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4114
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4114
                                                                                                                                                                                                 | 
                                                             				$i = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4115
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4115
                                                                                                                                                                                                 | 
                                                             				while ($i < $num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4116
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4116
                                                                                                                                                                                                 | 
                                                             					$objp = $this->db->fetch_object($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4117
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4117
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4118
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$opt = '<option value="' . $objp->idprodfournprice . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4118
                                                                                                                                                                                                 | 
                                                            +					$opt = '<option value="'.$objp->idprodfournprice.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4119
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4119
                                                                                                                                                                                                 | 
                                                             					//if there is only one supplier, preselect it  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4120
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4120
                                                                                                                                                                                                 | 
                                                             					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4121
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4121
                                                                                                                                                                                                 | 
                                                             						$opt .= ' selected';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4122
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4122
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4123
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4123
                                                                                                                                                                                                 | 
                                                            +					$opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4124
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4124
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4125
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4125
                                                                                                                                                                                                 | 
                                                             					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4126
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4126
                                                                                                                                                                                                 | 
                                                             						$prod_supplier = new ProductFournisseur($this->db);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4130,7 +4130,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4130
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4130
                                                                                                                                                                                                 | 
                                                             						$prod_supplier->fourn_tva_tx = $objp->tva_tx;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4131
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4131
                                                                                                                                                                                                 | 
                                                             						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4132
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4132
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4133
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4133
                                                                                                                                                                                                 | 
                                                            +						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4134
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4134
                                                                                                                                                                                                 | 
                                                             						$priceparser = new PriceParser($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4135
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4135
                                                                                                                                                                                                 | 
                                                             						$price_result = $priceparser->parseProductSupplier($prod_supplier);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4136
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4136
                                                                                                                                                                                                 | 
                                                             						if ($price_result >= 0) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4141,10 +4141,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4141
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4141
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4142
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4142
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4143
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4143
                                                                                                                                                                                                 | 
                                                             					if ($objp->quantity == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4144
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4144
                                                                                                                                                                                                 | 
                                                            +						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4145
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4145
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4146
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4146
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4147
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$opt .= $objp->quantity . ' ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4147
                                                                                                                                                                                                 | 
                                                            +					$opt .= $objp->quantity.' ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4148
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4148
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4149
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4149
                                                                                                                                                                                                 | 
                                                             					if ($objp->quantity == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4150
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4150
                                                                                                                                                                                                 | 
                                                             						$opt .= $langs->trans("Unit"); | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4153,10 +4153,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4153
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4153
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4154
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4154
                                                                                                                                                                                                 | 
                                                             					if ($objp->quantity > 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4155
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4155
                                                                                                                                                                                                 | 
                                                             						$opt .= " - ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4156
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$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"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4156
                                                                                                                                                                                                 | 
                                                            +						$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"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4157
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4157
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4158
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4158
                                                                                                                                                                                                 | 
                                                             					if ($objp->duration) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4159
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$opt .= " - " . $objp->duration;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4159
                                                                                                                                                                                                 | 
                                                            +						$opt .= " - ".$objp->duration;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4160
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4160
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4161
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4161
                                                                                                                                                                                                 | 
                                                             					$opt .= "</option>\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4162
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4162
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4194,8 +4194,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4194
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4194
                                                                                                                                                                                                 | 
                                                             		dol_syslog(__METHOD__, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4195
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4195
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4196
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4196
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT rowid, code, libelle as label, deposit_percent";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4197
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . 'c_payment_term';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4198
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4197
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix().'c_payment_term';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4198
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4199
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4199
                                                                                                                                                                                                 | 
                                                             		$sql .= " AND active > 0";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4200
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4200
                                                                                                                                                                                                 | 
                                                             		$sql .= " ORDER BY sortorder";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4201
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4201
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4207,7 +4207,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4207
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4207
                                                                                                                                                                                                 | 
                                                             				$obj = $this->db->fetch_object($resql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4208
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4208
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4209
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4209
                                                                                                                                                                                                 | 
                                                             				// Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4210
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4210
                                                                                                                                                                                                 | 
                                                            +				$label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4211
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4211
                                                                                                                                                                                                 | 
                                                             				$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4212
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4212
                                                                                                                                                                                                 | 
                                                             				$this->cache_conditions_paiements[$obj->rowid]['label'] = $label;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4213
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4213
                                                                                                                                                                                                 | 
                                                             				$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4235,7 +4235,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4235
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4235
                                                                                                                                                                                                 | 
                                                             		// phpcs:enable  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4236
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4236
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4237
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4237
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4238
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$num = count($this->cache_availability);    // TODO Use $conf->cache['availability'] instead of $this->cache_availability  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4238
                                                                                                                                                                                                 | 
                                                            +		$num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4239
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4239
                                                                                                                                                                                                 | 
                                                             		if ($num > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4240
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4240
                                                                                                                                                                                                 | 
                                                             			return 0; // Cache already loaded  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4241
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4241
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4245,7 +4245,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4245
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4245
                                                                                                                                                                                                 | 
                                                             		$langs->load('propal'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4246
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4246
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4247
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4247
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT rowid, code, label, position";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4248
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . 'c_availability';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4248
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix().'c_availability';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4249
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4249
                                                                                                                                                                                                 | 
                                                             		$sql .= " WHERE active > 0";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4250
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4250
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4251
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4251
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4256,7 +4256,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4256
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4256
                                                                                                                                                                                                 | 
                                                             				$obj = $this->db->fetch_object($resql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4257
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4257
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4258
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4258
                                                                                                                                                                                                 | 
                                                             				// Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4259
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4259
                                                                                                                                                                                                 | 
                                                            +				$label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4260
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4260
                                                                                                                                                                                                 | 
                                                             				$this->cache_availability[$obj->rowid]['code'] = $obj->code;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4261
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4261
                                                                                                                                                                                                 | 
                                                             				$this->cache_availability[$obj->rowid]['label'] = $label;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4262
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4262
                                                                                                                                                                                                 | 
                                                             				$this->cache_availability[$obj->rowid]['position'] = $obj->position;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4288,17 +4288,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4288
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4288
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4289
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4289
                                                                                                                                                                                                 | 
                                                             		$this->load_cache_availability();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4290
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4290
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4291
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4291
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4292
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4292
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4293
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4293
                                                                                                                                                                                                 | 
                                                            +		print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4294
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4294
                                                                                                                                                                                                 | 
                                                             		if ($addempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4295
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4295
                                                                                                                                                                                                 | 
                                                             			print '<option value="0"> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4296
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4296
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4297
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4297
                                                                                                                                                                                                 | 
                                                             		foreach ($this->cache_availability as $id => $arrayavailability) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4298
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4298
                                                                                                                                                                                                 | 
                                                             			if ($selected == $id) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4299
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<option value="' . $id . '" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4299
                                                                                                                                                                                                 | 
                                                            +				print '<option value="'.$id.'" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4300
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4300
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4301
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<option value="' . $id . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4301
                                                                                                                                                                                                 | 
                                                            +				print '<option value="'.$id.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4302
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4302
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4303
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4303
                                                                                                                                                                                                 | 
                                                             			print dol_escape_htmltag($arrayavailability['label']);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4304
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4304
                                                                                                                                                                                                 | 
                                                             			print '</option>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4319,13 +4319,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4319
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4319
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4320
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4320
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4321
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4321
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4322
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$num = count($this->cache_demand_reason);    // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4322
                                                                                                                                                                                                 | 
                                                            +		$num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4323
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4323
                                                                                                                                                                                                 | 
                                                             		if ($num > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4324
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4324
                                                                                                                                                                                                 | 
                                                             			return 0; // Cache already loaded  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4325
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4325
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4326
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4326
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4327
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4327
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT rowid, code, label";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4328
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . 'c_input_reason';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4328
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix().'c_input_reason';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4329
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4329
                                                                                                                                                                                                 | 
                                                             		$sql .= " WHERE active > 0";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4330
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4330
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4331
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4331
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4338,8 +4338,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4338
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4338
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4339
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4339
                                                                                                                                                                                                 | 
                                                             				// Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4340
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4340
                                                                                                                                                                                                 | 
                                                             				$label = ($obj->label != '-' ? $obj->label : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4341
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4342
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4341
                                                                                                                                                                                                 | 
                                                            +				if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4342
                                                                                                                                                                                                 | 
                                                            +					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4343
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4343
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4344
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4344
                                                                                                                                                                                                 | 
                                                             				if ($langs->trans($obj->code) != $obj->code) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4345
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4345
                                                                                                                                                                                                 | 
                                                             					$label = $langs->trans($obj->code); // So translation key SRC_XXX will work  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4379,9 +4379,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4379
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4379
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4380
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4380
                                                                                                                                                                                                 | 
                                                             		$this->loadCacheInputReason();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4381
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4381
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4382
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4382
                                                                                                                                                                                                 | 
                                                            +		print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4383
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4383
                                                                                                                                                                                                 | 
                                                             		if ($addempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4384
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4384
                                                                                                                                                                                                 | 
                                                            +			print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4385
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4385
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4386
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4386
                                                                                                                                                                                                 | 
                                                             		foreach ($this->cache_demand_reason as $id => $arraydemandreason) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4387
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4387
                                                                                                                                                                                                 | 
                                                             			if ($arraydemandreason['code'] == $exclude) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4389,9 +4389,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4389
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4389
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4390
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4390
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4391
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4391
                                                                                                                                                                                                 | 
                                                             			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4392
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<option value="' . $arraydemandreason['id'] . '" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4392
                                                                                                                                                                                                 | 
                                                            +				print '<option value="'.$arraydemandreason['id'].'" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4393
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4393
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4394
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<option value="' . $arraydemandreason['id'] . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4394
                                                                                                                                                                                                 | 
                                                            +				print '<option value="'.$arraydemandreason['id'].'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4395
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4395
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4396
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4396
                                                                                                                                                                                                 | 
                                                             			$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4397
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4397
                                                                                                                                                                                                 | 
                                                             			print $langs->trans($label);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4401,7 +4401,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4401
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4401
                                                                                                                                                                                                 | 
                                                             		if ($user->admin && empty($notooltip)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4402
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4402
                                                                                                                                                                                                 | 
                                                             			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4403
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4403
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4404
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		print ajax_combobox('select_' . $htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4404
                                                                                                                                                                                                 | 
                                                            +		print ajax_combobox('select_'.$htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4405
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4405
                                                                                                                                                                                                 | 
                                                             	}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4406
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4406
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4407
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4407
                                                                                                                                                                                                 | 
                                                             	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4416,7 +4416,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4416
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4416
                                                                                                                                                                                                 | 
                                                             		// phpcs:enable  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4417
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4417
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4418
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4418
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4419
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$num = count($this->cache_types_paiements);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4419
                                                                                                                                                                                                 | 
                                                            +		$num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4420
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4420
                                                                                                                                                                                                 | 
                                                             		if ($num > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4421
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4421
                                                                                                                                                                                                 | 
                                                             			return $num; // Cache already loaded  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4422
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4422
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4426,8 +4426,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4426
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4426
                                                                                                                                                                                                 | 
                                                             		$this->cache_types_paiements = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4427
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4427
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4428
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4428
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT id, code, libelle as label, type, active";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4429
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "c_paiement";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4430
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4429
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."c_paiement";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4430
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE entity IN (".getEntity('c_paiement').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4431
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4431
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4432
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4432
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4433
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4433
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4437,7 +4437,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4437
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4437
                                                                                                                                                                                                 | 
                                                             				$obj = $this->db->fetch_object($resql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4438
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4438
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4439
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4439
                                                                                                                                                                                                 | 
                                                             				// Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4440
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4440
                                                                                                                                                                                                 | 
                                                            +				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4441
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4441
                                                                                                                                                                                                 | 
                                                             				$this->cache_types_paiements[$obj->id]['id'] = $obj->id;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4442
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4442
                                                                                                                                                                                                 | 
                                                             				$this->cache_types_paiements[$obj->id]['code'] = $obj->code;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4443
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4443
                                                                                                                                                                                                 | 
                                                             				$this->cache_types_paiements[$obj->id]['label'] = $label;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4509,17 +4509,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4509
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4509
                                                                                                                                                                                                 | 
                                                             		global $langs, $user, $conf;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4510
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4510
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4511
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4511
                                                                                                                                                                                                 | 
                                                             		$out = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4512
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4512
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4513
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4513
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4514
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4514
                                                                                                                                                                                                 | 
                                                             		$this->load_cache_conditions_paiements();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4515
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4515
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4516
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4516
                                                                                                                                                                                                 | 
                                                             		// Set default value if not already set by caller  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4517
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4517
                                                                                                                                                                                                 | 
                                                             		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4518
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4518
                                                                                                                                                                                                 | 
                                                            +			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4519
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4519
                                                                                                                                                                                                 | 
                                                             			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4520
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4520
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4521
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4521
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4522
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4522
                                                                                                                                                                                                 | 
                                                            +		$out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4523
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4523
                                                                                                                                                                                                 | 
                                                             		if ($addempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4524
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4524
                                                                                                                                                                                                 | 
                                                             			$out .= '<option value="0"> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4525
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4525
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4533,9 +4533,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4533
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4533
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4534
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4534
                                                                                                                                                                                                 | 
                                                             			if ($selected == $id) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4535
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4535
                                                                                                                                                                                                 | 
                                                             				$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4536
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4536
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4537
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4537
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4538
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4538
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4539
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4539
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4540
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4540
                                                                                                                                                                                                 | 
                                                             			$label = $arrayconditions['label'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4541
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4541
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4553,21 +4553,21 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4553
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4553
                                                                                                                                                                                                 | 
                                                             		$out .= ajax_combobox($htmlname);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4554
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4554
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4555
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4555
                                                                                                                                                                                                 | 
                                                             		if ($deposit_percent >= 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4556
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4557
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= $langs->trans('DepositPercent') . ' : '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4558
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4556
                                                                                                                                                                                                 | 
                                                            +			$out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4557
                                                                                                                                                                                                 | 
                                                            +			$out .= $langs->trans('DepositPercent').' : '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4558
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4559
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4559
                                                                                                                                                                                                 | 
                                                             			$out .= '</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4560
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4560
                                                                                                                                                                                                 | 
                                                             			$out .= '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4561
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				<script nonce="' . getNonce() . '">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4561
                                                                                                                                                                                                 | 
                                                            +				<script nonce="' . getNonce().'">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4562
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4562
                                                                                                                                                                                                 | 
                                                             					$(document).ready(function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4563
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$("#' . $htmlname . '").change(function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4563
                                                                                                                                                                                                 | 
                                                            +						$("#' . $htmlname.'").change(function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4564
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4564
                                                                                                                                                                                                 | 
                                                             							let $selected = $(this).find("option:selected"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4565
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4565
                                                                                                                                                                                                 | 
                                                             							let depositPercent = $selected.attr("data-deposit_percent"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4566
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4566
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4567
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4567
                                                                                                                                                                                                 | 
                                                             							if (depositPercent.length > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4568
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4568
                                                                                                                                                                                                 | 
                                                            +								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4569
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4569
                                                                                                                                                                                                 | 
                                                             							} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4570
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$("#' . $htmlname . '_deposit_percent_container").hide(); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4570
                                                                                                                                                                                                 | 
                                                            +								$("#' . $htmlname.'_deposit_percent_container").hide(); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4571
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4571
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4572
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4572
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4573
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4573
                                                                                                                                                                                                 | 
                                                             							return true;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4605,7 +4605,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4605
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4605
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4606
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4606
                                                                                                                                                                                                 | 
                                                             		$out = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4607
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4607
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4608
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4608
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4609
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4609
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4610
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4610
                                                                                                                                                                                                 | 
                                                             		$filterarray = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4611
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4611
                                                                                                                                                                                                 | 
                                                             		if ($filtertype == 'CRDT') { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4620,11 +4620,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4620
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4620
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4621
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4621
                                                                                                                                                                                                 | 
                                                             		// Set default value if not already set by caller  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4622
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4622
                                                                                                                                                                                                 | 
                                                             		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4623
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4623
                                                                                                                                                                                                 | 
                                                            +			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4624
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4624
                                                                                                                                                                                                 | 
                                                             			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4625
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4625
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4626
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4626
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4627
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4627
                                                                                                                                                                                                 | 
                                                            +		$out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4628
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4628
                                                                                                                                                                                                 | 
                                                             		if ($empty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4629
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4629
                                                                                                                                                                                                 | 
                                                             			$out .= '<option value=""> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4630
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4630
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4645,13 +4645,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4645
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4645
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4646
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4646
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4647
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4647
                                                                                                                                                                                                 | 
                                                             			if ($format == 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4648
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="' . $id . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4648
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="'.$id.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4649
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4649
                                                                                                                                                                                                 | 
                                                             			} elseif ($format == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4650
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="' . $arraytypes['code'] . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4650
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="'.$arraytypes['code'].'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4651
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4651
                                                                                                                                                                                                 | 
                                                             			} elseif ($format == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4652
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="' . $arraytypes['code'] . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4652
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="'.$arraytypes['code'].'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4653
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4653
                                                                                                                                                                                                 | 
                                                             			} elseif ($format == 3) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4654
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="' . $id . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4654
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="'.$id.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4655
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4655
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4656
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4656
                                                                                                                                                                                                 | 
                                                             			// Print attribute selected or not  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4657
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4657
                                                                                                                                                                                                 | 
                                                             			if ($format == 1 || $format == 2) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4681,7 +4681,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4681
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4681
                                                                                                                                                                                                 | 
                                                             		if ($user->admin && !$noadmininfo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4682
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4682
                                                                                                                                                                                                 | 
                                                             			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4683
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4683
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4684
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out .= ajax_combobox('select' . $htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4684
                                                                                                                                                                                                 | 
                                                            +		$out .= ajax_combobox('select'.$htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4685
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4685
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4686
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4686
                                                                                                                                                                                                 | 
                                                             		if (empty($nooutput)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4687
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4687
                                                                                                                                                                                                 | 
                                                             			print $out;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4703,22 +4703,22 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4703
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4703
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4704
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4704
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4705
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4705
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4706
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4706
                                                                                                                                                                                                 | 
                                                            +		$return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4707
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4707
                                                                                                                                                                                                 | 
                                                             		$options = array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4708
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4708
                                                                                                                                                                                                 | 
                                                             			'HT' => $langs->trans("HT"), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4709
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4709
                                                                                                                                                                                                 | 
                                                             			'TTC' => $langs->trans("TTC") | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4710
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4710
                                                                                                                                                                                                 | 
                                                             		);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4711
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4711
                                                                                                                                                                                                 | 
                                                             		foreach ($options as $id => $value) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4712
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4712
                                                                                                                                                                                                 | 
                                                             			if ($selected == $id) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4713
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$return .= '<option value="' . $id . '" selected>' . $value;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4713
                                                                                                                                                                                                 | 
                                                            +				$return .= '<option value="'.$id.'" selected>'.$value;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4714
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4714
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4715
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$return .= '<option value="' . $id . '">' . $value;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4715
                                                                                                                                                                                                 | 
                                                            +				$return .= '<option value="'.$id.'">'.$value;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4716
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4716
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4717
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4717
                                                                                                                                                                                                 | 
                                                             			$return .= '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4718
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4718
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4719
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4719
                                                                                                                                                                                                 | 
                                                             		$return .= '</select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4720
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4720
                                                                                                                                                                                                 | 
                                                             		if ($addjscombo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4721
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$return .= ajax_combobox('select_' . $htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4721
                                                                                                                                                                                                 | 
                                                            +			$return .= ajax_combobox('select_'.$htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4722
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4722
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4723
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4723
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4724
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4724
                                                                                                                                                                                                 | 
                                                             		return $return;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4736,7 +4736,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4736
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4736
                                                                                                                                                                                                 | 
                                                             		// phpcs:enable  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4737
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4737
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4738
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4738
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4739
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$num = count($this->cache_transport_mode);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4739
                                                                                                                                                                                                 | 
                                                            +		$num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4740
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4740
                                                                                                                                                                                                 | 
                                                             		if ($num > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4741
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4741
                                                                                                                                                                                                 | 
                                                             			return $num; // Cache already loaded  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4742
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4742
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4746,8 +4746,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4746
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4746
                                                                                                                                                                                                 | 
                                                             		$this->cache_transport_mode = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4747
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4747
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4748
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4748
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT rowid, code, label, active";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4749
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "c_transport_mode";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4750
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4749
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."c_transport_mode";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4750
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4751
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4751
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4752
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4752
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4753
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4753
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4757,7 +4757,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4757
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4757
                                                                                                                                                                                                 | 
                                                             				$obj = $this->db->fetch_object($resql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4758
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4758
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4759
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4759
                                                                                                                                                                                                 | 
                                                             				// If traduction exist, we use it else we take the default label  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4760
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4760
                                                                                                                                                                                                 | 
                                                            +				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4761
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4761
                                                                                                                                                                                                 | 
                                                             				$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4762
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4762
                                                                                                                                                                                                 | 
                                                             				$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4763
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4763
                                                                                                                                                                                                 | 
                                                             				$this->cache_transport_mode[$obj->rowid]['label'] = $label;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4791,11 +4791,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4791
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4791
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4792
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4792
                                                                                                                                                                                                 | 
                                                             		global $langs, $user;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4793
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4793
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4794
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4794
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4795
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4795
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4796
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4796
                                                                                                                                                                                                 | 
                                                             		$this->load_cache_transport_mode();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4797
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4797
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4798
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4798
                                                                                                                                                                                                 | 
                                                            +		print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4799
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4799
                                                                                                                                                                                                 | 
                                                             		if ($empty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4800
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4800
                                                                                                                                                                                                 | 
                                                             			print '<option value=""> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4801
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4801
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4811,13 +4811,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4811
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4811
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4812
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4812
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4813
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4813
                                                                                                                                                                                                 | 
                                                             			if ($format == 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4814
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<option value="' . $id . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4814
                                                                                                                                                                                                 | 
                                                            +				print '<option value="'.$id.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4815
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4815
                                                                                                                                                                                                 | 
                                                             			} elseif ($format == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4816
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<option value="' . $arraytypes['code'] . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4816
                                                                                                                                                                                                 | 
                                                            +				print '<option value="'.$arraytypes['code'].'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4817
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4817
                                                                                                                                                                                                 | 
                                                             			} elseif ($format == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4818
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<option value="' . $arraytypes['code'] . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4818
                                                                                                                                                                                                 | 
                                                            +				print '<option value="'.$arraytypes['code'].'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4819
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4819
                                                                                                                                                                                                 | 
                                                             			} elseif ($format == 3) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4820
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<option value="' . $id . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4820
                                                                                                                                                                                                 | 
                                                            +				print '<option value="'.$id.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4821
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4821
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4822
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4822
                                                                                                                                                                                                 | 
                                                             			// If text is selected, we compare with code, else with id  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4823
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4823
                                                                                                                                                                                                 | 
                                                             			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4865,31 +4865,31 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4865
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4865
                                                                                                                                                                                                 | 
                                                             		$langs->load("deliveries"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4866
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4866
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4867
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4867
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT rowid, code, libelle as label";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4868
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "c_shipment_mode";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4868
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."c_shipment_mode";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4869
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4869
                                                                                                                                                                                                 | 
                                                             		$sql .= " WHERE active > 0";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4870
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4870
                                                                                                                                                                                                 | 
                                                             		if ($filtre) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4871
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND " . $filtre;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4871
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND ".$filtre;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4872
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4872
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4873
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4873
                                                                                                                                                                                                 | 
                                                             		$sql .= " ORDER BY libelle ASC";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4874
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4874
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4875
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4875
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4876
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4876
                                                                                                                                                                                                 | 
                                                             		$result = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4877
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4877
                                                                                                                                                                                                 | 
                                                             		if ($result) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4878
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4878
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4879
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4879
                                                                                                                                                                                                 | 
                                                             			$i = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4880
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4880
                                                                                                                                                                                                 | 
                                                             			if ($num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4881
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4881
                                                                                                                                                                                                 | 
                                                            +				print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4882
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4882
                                                                                                                                                                                                 | 
                                                             				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4883
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4883
                                                                                                                                                                                                 | 
                                                             					print '<option value="-1"> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4884
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4884
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4885
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4885
                                                                                                                                                                                                 | 
                                                             				while ($i < $num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4886
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4886
                                                                                                                                                                                                 | 
                                                             					$obj = $this->db->fetch_object($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4887
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4887
                                                                                                                                                                                                 | 
                                                             					if ($selected == $obj->rowid) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4888
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4888
                                                                                                                                                                                                 | 
                                                            +						print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4889
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4889
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4890
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print '<option value="' . $obj->rowid . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4890
                                                                                                                                                                                                 | 
                                                            +						print '<option value="'.$obj->rowid.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4891
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4891
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4892
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4892
                                                                                                                                                                                                 | 
                                                            +					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4893
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4893
                                                                                                                                                                                                 | 
                                                             					print '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4894
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4894
                                                                                                                                                                                                 | 
                                                             					$i++;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4895
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4895
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4898,7 +4898,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4898
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4898
                                                                                                                                                                                                 | 
                                                             					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4899
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4899
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4900
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4900
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4901
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print ajax_combobox('select' . $htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4901
                                                                                                                                                                                                 | 
                                                            +				print ajax_combobox('select'.$htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4902
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4902
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4903
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4903
                                                                                                                                                                                                 | 
                                                             				print $langs->trans("NoShippingMethodDefined"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4904
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4904
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4923,16 +4923,16 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4923
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4923
                                                                                                                                                                                                 | 
                                                             		$langs->load("deliveries"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4924
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4924
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4925
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4925
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4926
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<form method="POST" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4926
                                                                                                                                                                                                 | 
                                                            +			print '<form method="POST" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4927
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4927
                                                                                                                                                                                                 | 
                                                             			print '<input type="hidden" name="action" value="setshippingmethod">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4928
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4928
                                                                                                                                                                                                 | 
                                                            +			print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4929
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4929
                                                                                                                                                                                                 | 
                                                             			$this->selectShippingMethod($selected, $htmlname, '', $addempty);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4930
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4930
                                                                                                                                                                                                 | 
                                                            +			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4931
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4931
                                                                                                                                                                                                 | 
                                                             			print '</form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4932
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4932
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4933
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4933
                                                                                                                                                                                                 | 
                                                             			if ($selected) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4934
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4934
                                                                                                                                                                                                 | 
                                                             				$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4935
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print $langs->trans("SendingMethod" . strtoupper($code)); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4935
                                                                                                                                                                                                 | 
                                                            +				print $langs->trans("SendingMethod".strtoupper($code)); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4936
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4936
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4937
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4937
                                                                                                                                                                                                 | 
                                                             				print " ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4938
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4938
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4955,10 +4955,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4955
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4955
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4956
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4956
                                                                                                                                                                                                 | 
                                                             		$opt = '<option value="" selected></option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4957
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4957
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4958
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= ' FROM ' . $this->db->prefix() . 'facture';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4959
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4958
                                                                                                                                                                                                 | 
                                                            +		$sql .= ' FROM '.$this->db->prefix().'facture';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4959
                                                                                                                                                                                                 | 
                                                            +		$sql .= ' WHERE entity IN ('.getEntity('invoice').')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4960
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4960
                                                                                                                                                                                                 | 
                                                             		$sql .= ' AND situation_counter >= 1';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4961
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= ' AND fk_soc = ' . (int) $socid;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4961
                                                                                                                                                                                                 | 
                                                            +		$sql .= ' AND fk_soc = '.(int) $socid;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4962
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4962
                                                                                                                                                                                                 | 
                                                             		$sql .= ' AND type <> 2';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4963
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4963
                                                                                                                                                                                                 | 
                                                             		$sql .= ' ORDER by situation_cycle_ref, situation_counter desc';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4964
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4964
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -4976,19 +4976,19 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    4976
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4976
                                                                                                                                                                                                 | 
                                                             						//Not prov?  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4977
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4977
                                                                                                                                                                                                 | 
                                                             						if (substr($obj->ref, 1, 4) != 'PROV') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4978
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4978
                                                                                                                                                                                                 | 
                                                             							if ($selected == $obj->rowid) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4979
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4979
                                                                                                                                                                                                 | 
                                                            +								$opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4980
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4980
                                                                                                                                                                                                 | 
                                                             							} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4981
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4981
                                                                                                                                                                                                 | 
                                                            +								$opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4982
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4982
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4983
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4983
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4984
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4984
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4985
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4985
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4986
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4986
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4987
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4987
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4988
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4988
                                                                                                                                                                                                 | 
                                                            +			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4989
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4989
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4990
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4990
                                                                                                                                                                                                 | 
                                                             		if ($opt == '<option value ="" selected></option>') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4991
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    4991
                                                                                                                                                                                                 | 
                                                            +			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4992
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4992
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4993
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4993
                                                                                                                                                                                                 | 
                                                             		return $opt;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    4994
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    4994
                                                                                                                                                                                                 | 
                                                             	}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5008,12 +5008,12 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5008
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5008
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5009
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5009
                                                                                                                                                                                                 | 
                                                             		$langs->load('products'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5010
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5010
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5011
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5011
                                                                                                                                                                                                 | 
                                                            +		$return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5012
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5012
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5013
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5013
                                                                                                                                                                                                 | 
                                                            +		$sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5014
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5014
                                                                                                                                                                                                 | 
                                                             		$sql .= ' WHERE active > 0';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5015
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5015
                                                                                                                                                                                                 | 
                                                             		if (!empty($unit_type)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5016
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5016
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5017
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5017
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5018
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5018
                                                                                                                                                                                                 | 
                                                             		$sql .= " ORDER BY sortorder";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5019
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5019
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5025,14 +5025,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5025
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5025
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5026
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5026
                                                                                                                                                                                                 | 
                                                             			while ($res = $this->db->fetch_object($resql)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5027
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5027
                                                                                                                                                                                                 | 
                                                             				$unitLabel = $res->label;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5028
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5029
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5028
                                                                                                                                                                                                 | 
                                                            +				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5029
                                                                                                                                                                                                 | 
                                                            +					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5030
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5030
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5031
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5031
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5032
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5032
                                                                                                                                                                                                 | 
                                                             				if ($selected == $res->rowid) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5033
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5033
                                                                                                                                                                                                 | 
                                                            +					$return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5034
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5034
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5035
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5035
                                                                                                                                                                                                 | 
                                                            +					$return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5036
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5036
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5037
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5037
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5038
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5038
                                                                                                                                                                                                 | 
                                                             			$return .= '</select>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5067,23 +5067,23 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5067
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5067
                                                                                                                                                                                                 | 
                                                             		$num = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5068
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5068
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5069
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5069
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT rowid, label, bank, clos as status, currency_code";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5070
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "bank_account";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5071
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5070
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."bank_account";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5071
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE entity IN (".getEntity('bank_account').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5072
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5072
                                                                                                                                                                                                 | 
                                                             		if ($status != 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5073
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND clos = " . (int) $status;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5073
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND clos = ".(int) $status;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5074
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5074
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5075
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5075
                                                                                                                                                                                                 | 
                                                             		if ($filtre) {	// TODO Support USF | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5076
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND " . $filtre;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5076
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND ".$filtre;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5077
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5077
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5078
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5078
                                                                                                                                                                                                 | 
                                                             		$sql .= " ORDER BY label";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5079
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5079
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5080
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5080
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5081
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5081
                                                                                                                                                                                                 | 
                                                             		$result = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5082
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5082
                                                                                                                                                                                                 | 
                                                             		if ($result) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5083
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5083
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5084
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5084
                                                                                                                                                                                                 | 
                                                             			$i = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5085
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5085
                                                                                                                                                                                                 | 
                                                             			if ($num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5086
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5086
                                                                                                                                                                                                 | 
                                                            +				$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5087
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5087
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5088
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5088
                                                                                                                                                                                                 | 
                                                             				if (!empty($useempty) && !is_numeric($useempty)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5089
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5089
                                                                                                                                                                                                 | 
                                                             					$out .= '<option value="-1">'.$langs->trans($useempty).'</option>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5094,27 +5094,27 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5094
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5094
                                                                                                                                                                                                 | 
                                                             				while ($i < $num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5095
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5095
                                                                                                                                                                                                 | 
                                                             					$obj = $this->db->fetch_object($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5096
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5096
                                                                                                                                                                                                 | 
                                                             					if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5097
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5097
                                                                                                                                                                                                 | 
                                                            +						$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5098
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5098
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5099
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5099
                                                                                                                                                                                                 | 
                                                            +						$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5100
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5100
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5101
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5101
                                                                                                                                                                                                 | 
                                                             					$out .= trim($obj->label);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5102
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5102
                                                                                                                                                                                                 | 
                                                             					if ($showcurrency) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5103
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= ' (' . $obj->currency_code . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5103
                                                                                                                                                                                                 | 
                                                            +						$out .= ' ('.$obj->currency_code.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5104
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5104
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5105
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5105
                                                                                                                                                                                                 | 
                                                             					if ($status == 2 && $obj->status == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5106
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= ' (' . $langs->trans("Closed") . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5106
                                                                                                                                                                                                 | 
                                                            +						$out .= ' ('.$langs->trans("Closed").')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5107
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5107
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5108
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5108
                                                                                                                                                                                                 | 
                                                             					$out .= '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5109
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5109
                                                                                                                                                                                                 | 
                                                             					$i++;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5110
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5110
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5111
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5111
                                                                                                                                                                                                 | 
                                                             				$out .= "</select>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5112
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= ajax_combobox('select' . $htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5112
                                                                                                                                                                                                 | 
                                                            +				$out .= ajax_combobox('select'.$htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5113
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5113
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5114
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5114
                                                                                                                                                                                                 | 
                                                             				if ($status == 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5115
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5115
                                                                                                                                                                                                 | 
                                                            +					$out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5116
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5116
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5117
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5117
                                                                                                                                                                                                 | 
                                                            +					$out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5118
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5118
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5119
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5119
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5120
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5120
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5150,23 +5150,23 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5150
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5150
                                                                                                                                                                                                 | 
                                                             		$num = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5151
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5151
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5152
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5152
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT rowid, name, fk_country, status, entity";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5153
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "establishment";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5153
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."establishment";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5154
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5154
                                                                                                                                                                                                 | 
                                                             		$sql .= " WHERE 1=1";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5155
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5155
                                                                                                                                                                                                 | 
                                                             		if ($status != 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5156
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND status = " . (int) $status;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5156
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND status = ".(int) $status;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5157
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5157
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5158
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5158
                                                                                                                                                                                                 | 
                                                             		if ($filtre) {	// TODO Support USF | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5159
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND " . $filtre;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5159
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND ".$filtre;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5160
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5160
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5161
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5161
                                                                                                                                                                                                 | 
                                                             		$sql .= " ORDER BY name";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5162
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5162
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5163
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5163
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5164
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5164
                                                                                                                                                                                                 | 
                                                             		$result = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5165
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5165
                                                                                                                                                                                                 | 
                                                             		if ($result) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5166
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5166
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5167
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5167
                                                                                                                                                                                                 | 
                                                             			$i = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5168
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5168
                                                                                                                                                                                                 | 
                                                             			if ($num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5169
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5169
                                                                                                                                                                                                 | 
                                                            +				print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5170
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5170
                                                                                                                                                                                                 | 
                                                             				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5171
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5171
                                                                                                                                                                                                 | 
                                                             					print '<option value="-1"> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5172
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5172
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5174,13 +5174,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5174
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5174
                                                                                                                                                                                                 | 
                                                             				while ($i < $num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5175
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5175
                                                                                                                                                                                                 | 
                                                             					$obj = $this->db->fetch_object($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5176
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5176
                                                                                                                                                                                                 | 
                                                             					if ($selected == $obj->rowid) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5177
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5177
                                                                                                                                                                                                 | 
                                                            +						print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5178
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5178
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5179
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print '<option value="' . $obj->rowid . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5179
                                                                                                                                                                                                 | 
                                                            +						print '<option value="'.$obj->rowid.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5180
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5180
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5181
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5181
                                                                                                                                                                                                 | 
                                                             					print trim($obj->name);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5182
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5182
                                                                                                                                                                                                 | 
                                                             					if ($status == 2 && $obj->status == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5183
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print ' (' . $langs->trans("Closed") . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5183
                                                                                                                                                                                                 | 
                                                            +						print ' ('.$langs->trans("Closed").')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5184
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5184
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5185
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5185
                                                                                                                                                                                                 | 
                                                             					print '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5186
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5186
                                                                                                                                                                                                 | 
                                                             					$i++;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5188,9 +5188,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5188
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5188
                                                                                                                                                                                                 | 
                                                             				print "</select>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5189
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5189
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5190
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5190
                                                                                                                                                                                                 | 
                                                             				if ($status == 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5191
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5191
                                                                                                                                                                                                 | 
                                                            +					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5192
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5192
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5193
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5193
                                                                                                                                                                                                 | 
                                                            +					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5194
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5194
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5195
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5195
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5196
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5196
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5214,20 +5214,20 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5214
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5214
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5215
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5215
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5216
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5216
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5217
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<form method="POST" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5217
                                                                                                                                                                                                 | 
                                                            +			print '<form method="POST" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5218
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5218
                                                                                                                                                                                                 | 
                                                             			print '<input type="hidden" name="action" value="setbankaccount">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5219
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5219
                                                                                                                                                                                                 | 
                                                            +			print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5220
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5220
                                                                                                                                                                                                 | 
                                                             			print img_picto('', 'bank_account', 'class="pictofixedwidth"'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5221
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5221
                                                                                                                                                                                                 | 
                                                             			$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5222
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5222
                                                                                                                                                                                                 | 
                                                             			if ($nbaccountfound > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5223
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5223
                                                                                                                                                                                                 | 
                                                            +				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5224
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5224
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5225
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5225
                                                                                                                                                                                                 | 
                                                             			print '</form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5226
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5226
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5227
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5227
                                                                                                                                                                                                 | 
                                                             			$langs->load('banks'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5228
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5228
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5229
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5229
                                                                                                                                                                                                 | 
                                                             			if ($selected) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5230
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5230
                                                                                                                                                                                                 | 
                                                            +				require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5231
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5231
                                                                                                                                                                                                 | 
                                                             				$bankstatic = new Account($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5232
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5232
                                                                                                                                                                                                 | 
                                                             				$result = $bankstatic->fetch($selected);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5233
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5233
                                                                                                                                                                                                 | 
                                                             				if ($result) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5266,19 +5266,19 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5266
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5266
                                                                                                                                                                                                 | 
                                                             		global $conf, $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5267
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5267
                                                                                                                                                                                                 | 
                                                             		$langs->load("categories"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5268
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5268
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5269
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5269
                                                                                                                                                                                                 | 
                                                            +		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5270
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5270
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5271
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5271
                                                                                                                                                                                                 | 
                                                             		// For backward compatibility  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5272
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5272
                                                                                                                                                                                                 | 
                                                             		if (is_numeric($type)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5273
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5273
                                                                                                                                                                                                 | 
                                                            +			dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5274
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5274
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5275
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5275
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5276
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5276
                                                                                                                                                                                                 | 
                                                             		if ($type === Categorie::TYPE_BANK_LINE) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5277
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5277
                                                                                                                                                                                                 | 
                                                             			// TODO Move this into common category feature  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5278
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5278
                                                                                                                                                                                                 | 
                                                             			$cate_arbo = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5279
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5279
                                                                                                                                                                                                 | 
                                                             			$sql = "SELECT c.label, c.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5280
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " FROM " . $this->db->prefix() . "bank_categ as c";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5281
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " WHERE entity = " . $conf->entity;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5280
                                                                                                                                                                                                 | 
                                                            +			$sql .= " FROM ".$this->db->prefix()."bank_categ as c";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5281
                                                                                                                                                                                                 | 
                                                            +			$sql .= " WHERE entity = ".$conf->entity;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5282
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5282
                                                                                                                                                                                                 | 
                                                             			$sql .= " ORDER BY c.label";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5283
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5283
                                                                                                                                                                                                 | 
                                                             			$result = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5284
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5284
                                                                                                                                                                                                 | 
                                                             			if ($result) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5304,12 +5304,12 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5304
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5304
                                                                                                                                                                                                 | 
                                                             		$outarrayrichhtml = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5305
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5305
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5306
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5306
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5307
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5307
                                                                                                                                                                                                 | 
                                                            +		$output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5308
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5308
                                                                                                                                                                                                 | 
                                                             		if (is_array($cate_arbo)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5309
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5309
                                                                                                                                                                                                 | 
                                                             			$num = count($cate_arbo);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5310
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5310
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5311
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5311
                                                                                                                                                                                                 | 
                                                             			if (!$num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5312
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5312
                                                                                                                                                                                                 | 
                                                            +				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5313
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5313
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5314
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5314
                                                                                                                                                                                                 | 
                                                             				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5315
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5315
                                                                                                                                                                                                 | 
                                                             					$output .= '<option value="-1"> </option>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5321,15 +5321,15 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5321
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5321
                                                                                                                                                                                                 | 
                                                             						$add = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5322
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5322
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5323
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5323
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5324
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5324
                                                                                                                                                                                                 | 
                                                            +					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5325
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5325
                                                                                                                                                                                                 | 
                                                             					$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5326
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5326
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5327
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5327
                                                                                                                                                                                                 | 
                                                             					$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5328
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5328
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5329
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5329
                                                                                                                                                                                                 | 
                                                             					$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5330
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5330
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5331
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5332
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5331
                                                                                                                                                                                                 | 
                                                            +					$output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5332
                                                                                                                                                                                                 | 
                                                            +					$output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5333
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5333
                                                                                                                                                                                                 | 
                                                             					$output .= '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5334
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5334
                                                                                                                                                                                                 | 
                                                             					$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5335
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5335
                                                                                                                                                                                                 | 
                                                             					$output .= '</option>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5373,7 +5373,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5373
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5373
                                                                                                                                                                                                 | 
                                                             	public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5374
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5374
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5375
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5375
                                                                                                                                                                                                 | 
                                                             		// phpcs:enable  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5376
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5376
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5377
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5377
                                                                                                                                                                                                 | 
                                                             		print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5378
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5378
                                                                                                                                                                                                 | 
                                                             	}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5379
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5379
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5408,7 +5408,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5408
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5408
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5409
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5409
                                                                                                                                                                                                 | 
                                                             		global $langs, $conf;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5410
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5410
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5411
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5411
                                                                                                                                                                                                 | 
                                                            +		$more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5412
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5412
                                                                                                                                                                                                 | 
                                                             		$formconfirm = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5413
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5413
                                                                                                                                                                                                 | 
                                                             		$inputok = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5414
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5414
                                                                                                                                                                                                 | 
                                                             		$inputko = array();  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5432,27 +5432,27 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5432
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5432
                                                                                                                                                                                                 | 
                                                             			foreach ($formquestion as $key => $input) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5433
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5433
                                                                                                                                                                                                 | 
                                                             				if (is_array($input) && !empty($input)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5434
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5434
                                                                                                                                                                                                 | 
                                                             					if ($input['type'] == 'hidden') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5435
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5436
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5435
                                                                                                                                                                                                 | 
                                                            +						$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5436
                                                                                                                                                                                                 | 
                                                            +						$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5437
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5437
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5438
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$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";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5438
                                                                                                                                                                                                 | 
                                                            +						$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";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5439
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5439
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5440
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5440
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5441
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5441
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5442
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5442
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5443
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5443
                                                                                                                                                                                                 | 
                                                             			// Now add questions  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5444
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5444
                                                                                                                                                                                                 | 
                                                             			$moreonecolumn = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5445
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5445
                                                                                                                                                                                                 | 
                                                            +			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5446
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5446
                                                                                                                                                                                                 | 
                                                             			foreach ($formquestion as $key => $input) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5447
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5447
                                                                                                                                                                                                 | 
                                                             				if (is_array($input) && !empty($input)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5448
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : '');    // deprecated. Use morecss instead.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5449
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5450
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5448
                                                                                                                                                                                                 | 
                                                            +					$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5449
                                                                                                                                                                                                 | 
                                                            +					$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5450
                                                                                                                                                                                                 | 
                                                            +					$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5451
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5451
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5452
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5452
                                                                                                                                                                                                 | 
                                                             					if ($input['type'] == 'text') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5453
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$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"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5453
                                                                                                                                                                                                 | 
                                                            +						$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"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5454
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5454
                                                                                                                                                                                                 | 
                                                             					} elseif ($input['type'] == 'password') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5455
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$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"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5455
                                                                                                                                                                                                 | 
                                                            +						$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"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5456
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5456
                                                                                                                                                                                                 | 
                                                             					} elseif ($input['type'] == 'textarea') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5457
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5457
                                                                                                                                                                                                 | 
                                                             						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5458
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5458
                                                                                                                                                                                                 | 
                                                             						$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5460,8 +5460,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5460
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5460
                                                                                                                                                                                                 | 
                                                             						$more .= '</textarea>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5461
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5461
                                                                                                                                                                                                 | 
                                                             						$more .= '</div></div>'."\n";*/  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5462
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5462
                                                                                                                                                                                                 | 
                                                             						$moreonecolumn .= '<div class="margintoponly">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5463
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$moreonecolumn .= $input['label'] . '<br>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5464
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5463
                                                                                                                                                                                                 | 
                                                            +						$moreonecolumn .= $input['label'].'<br>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5464
                                                                                                                                                                                                 | 
                                                            +						$moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5465
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5465
                                                                                                                                                                                                 | 
                                                             						$moreonecolumn .= $input['value'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5466
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5466
                                                                                                                                                                                                 | 
                                                             						$moreonecolumn .= '</textarea>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5467
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5467
                                                                                                                                                                                                 | 
                                                             						$moreonecolumn .= '</div>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5478,20 +5478,20 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5478
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5478
                                                                                                                                                                                                 | 
                                                             						$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5479
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5479
                                                                                                                                                                                                 | 
                                                             						$sort = isset($input['select_sort']) ? $input['select_sort'] : '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5480
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5480
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5481
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5481
                                                                                                                                                                                                 | 
                                                            +						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5482
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5482
                                                                                                                                                                                                 | 
                                                             						if (!empty($input['label'])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5483
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$more .= $input['label'] . '</div><div class="tagtd left">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5483
                                                                                                                                                                                                 | 
                                                            +							$more .= $input['label'].'</div><div class="tagtd left">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5484
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5484
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5485
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5485
                                                                                                                                                                                                 | 
                                                             						if ($input['type'] == 'select') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5486
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5486
                                                                                                                                                                                                 | 
                                                             							$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);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5487
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5487
                                                                                                                                                                                                 | 
                                                             						} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5488
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5488
                                                                                                                                                                                                 | 
                                                             							$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);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5489
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5489
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5490
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$more .= '</div></div>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5490
                                                                                                                                                                                                 | 
                                                            +						$more .= '</div></div>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5491
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5491
                                                                                                                                                                                                 | 
                                                             					} elseif ($input['type'] == 'checkbox') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5492
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5492
                                                                                                                                                                                                 | 
                                                             						$more .= '<div class="tagtr">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5493
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5494
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5493
                                                                                                                                                                                                 | 
                                                            +						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5494
                                                                                                                                                                                                 | 
                                                            +						$more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5495
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5495
                                                                                                                                                                                                 | 
                                                             						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5496
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5496
                                                                                                                                                                                                 | 
                                                             							$more .= ' checked';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5497
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5497
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5502,19 +5502,19 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5502
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5502
                                                                                                                                                                                                 | 
                                                             							$more .= ' disabled';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5503
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5503
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5504
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5504
                                                                                                                                                                                                 | 
                                                             						$more .= ' /></div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5505
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$more .= '</div>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5505
                                                                                                                                                                                                 | 
                                                            +						$more .= '</div>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5506
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5506
                                                                                                                                                                                                 | 
                                                             					} elseif ($input['type'] == 'radio') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5507
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5507
                                                                                                                                                                                                 | 
                                                             						$i = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5508
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5508
                                                                                                                                                                                                 | 
                                                             						foreach ($input['values'] as $selkey => $selval) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5509
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5509
                                                                                                                                                                                                 | 
                                                             							$more .= '<div class="tagtr">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5510
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5510
                                                                                                                                                                                                 | 
                                                             							if (isset($input['label'])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5511
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5511
                                                                                                                                                                                                 | 
                                                             								if ($i == 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5512
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5512
                                                                                                                                                                                                 | 
                                                            +									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5513
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5513
                                                                                                                                                                                                 | 
                                                             								} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5514
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5514
                                                                                                                                                                                                 | 
                                                            +									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5515
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5515
                                                                                                                                                                                                 | 
                                                             								}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5516
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5516
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5517
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$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;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5517
                                                                                                                                                                                                 | 
                                                            +							$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;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5518
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5518
                                                                                                                                                                                                 | 
                                                             							if (!empty($input['disabled'])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5519
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5519
                                                                                                                                                                                                 | 
                                                             								$more .= ' disabled';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5520
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5520
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5522,12 +5522,12 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5522
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5522
                                                                                                                                                                                                 | 
                                                             								$more .= ' checked="checked"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5523
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5523
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5524
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5524
                                                                                                                                                                                                 | 
                                                             							$more .= ' /> ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5525
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5526
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$more .= '</div></div>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5525
                                                                                                                                                                                                 | 
                                                            +							$more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5526
                                                                                                                                                                                                 | 
                                                            +							$more .= '</div></div>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5527
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5527
                                                                                                                                                                                                 | 
                                                             							$i++;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5528
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5528
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5529
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5529
                                                                                                                                                                                                 | 
                                                             					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5530
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5530
                                                                                                                                                                                                 | 
                                                            +						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5531
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5531
                                                                                                                                                                                                 | 
                                                             						$more .= '<div class="tagtd">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5532
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5532
                                                                                                                                                                                                 | 
                                                             						$addnowlink = (empty($input['datenow']) ? 0 : 1);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5533
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5533
                                                                                                                                                                                                 | 
                                                             						$h = $m = 0;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5545,24 +5545,24 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5545
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5545
                                                                                                                                                                                                 | 
                                                             					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5546
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5546
                                                                                                                                                                                                 | 
                                                             						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5547
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5547
                                                                                                                                                                                                 | 
                                                             						if (!empty($input['label'])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5548
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$more .= $input['label'] . '</div><div class="tagtd">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5548
                                                                                                                                                                                                 | 
                                                            +							$more .= $input['label'].'</div><div class="tagtd">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5549
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5549
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5550
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5550
                                                                                                                                                                                                 | 
                                                             						$more .= $input['value'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5551
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$more .= '</div></div>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5551
                                                                                                                                                                                                 | 
                                                            +						$more .= '</div></div>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5552
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5552
                                                                                                                                                                                                 | 
                                                             					} elseif ($input['type'] == 'onecolumn') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5553
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5553
                                                                                                                                                                                                 | 
                                                             						$moreonecolumn .= '<div class="margintoponly">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5554
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5554
                                                                                                                                                                                                 | 
                                                             						$moreonecolumn .= $input['value'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5555
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$moreonecolumn .= '</div>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5555
                                                                                                                                                                                                 | 
                                                            +						$moreonecolumn .= '</div>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5556
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5556
                                                                                                                                                                                                 | 
                                                             					} elseif ($input['type'] == 'hidden') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5557
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5557
                                                                                                                                                                                                 | 
                                                             						// Do nothing more, already added by a previous loop  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5558
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5558
                                                                                                                                                                                                 | 
                                                             					} elseif ($input['type'] == 'separator') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5559
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5559
                                                                                                                                                                                                 | 
                                                             						$more .= '<br>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5560
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5560
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5561
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5561
                                                                                                                                                                                                 | 
                                                            +						$more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5562
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5562
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5563
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5563
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5564
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5564
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5565
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$more .= '</div>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5565
                                                                                                                                                                                                 | 
                                                            +			$more .= '</div>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5566
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5566
                                                                                                                                                                                                 | 
                                                             			$more .= $moreonecolumn;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5567
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5567
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5568
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5568
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5584,10 +5584,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5584
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5584
                                                                                                                                                                                                 | 
                                                             				$button = $useajax;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5585
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5585
                                                                                                                                                                                                 | 
                                                             				$useajax = 1;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5586
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5586
                                                                                                                                                                                                 | 
                                                             				$autoOpen = false;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5587
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$dialogconfirm .= '-' . $button;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5587
                                                                                                                                                                                                 | 
                                                            +				$dialogconfirm .= '-'.$button;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5588
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5588
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5589
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5590
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5589
                                                                                                                                                                                                 | 
                                                            +			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5590
                                                                                                                                                                                                 | 
                                                            +			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5591
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5591
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5592
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5592
                                                                                                                                                                                                 | 
                                                             			// Add input fields into list of fields to read during submit (inputok and inputko)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5593
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5593
                                                                                                                                                                                                 | 
                                                             			if (is_array($formquestion)) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5610,24 +5610,24 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5610
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5610
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5611
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5611
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5612
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5612
                                                                                                                                                                                                 | 
                                                             			// Show JQuery confirm box.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5613
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5613
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5614
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5614
                                                                                                                                                                                                 | 
                                                             			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5615
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5615
                                                                                                                                                                                                 | 
                                                            +				$formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5616
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5616
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5617
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5617
                                                                                                                                                                                                 | 
                                                             			if (!empty($more)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5618
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5618
                                                                                                                                                                                                 | 
                                                            +				$formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5619
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5619
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5620
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5621
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= '</div>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5620
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5621
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= '</div>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5622
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5622
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5623
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5624
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5623
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5624
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5625
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5625
                                                                                                                                                                                                 | 
                                                             			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5626
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5626
                                                                                                                                                                                                 | 
                                                             			$formconfirm .= 'jQuery(document).ready(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5627
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5627
                                                                                                                                                                                                 | 
                                                                         $(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5628
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -            	$( "#' . $dialogconfirm . '" ).dialog(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5628
                                                                                                                                                                                                 | 
                                                            +            	$( "#' . $dialogconfirm.'" ).dialog(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5629
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5629
                                                                                                                                                                                                 | 
                                                                         	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5630
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                    autoOpen: ' . ($autoOpen ? "true" : "false") . ',';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5630
                                                                                                                                                                                                 | 
                                                            +                    autoOpen: ' . ($autoOpen ? "true" : "false").',';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5631
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5631
                                                                                                                                                                                                 | 
                                                             			if ($newselectedchoice == 'no') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5632
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5632
                                                                                                                                                                                                 | 
                                                             				$formconfirm .= '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5633
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5633
                                                                                                                                                                                                 | 
                                                             						open: function() { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5637,24 +5637,24 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5637
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5637
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5638
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5638
                                                                                                                                                                                                 | 
                                                             			$jsforcursor = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5639
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5639
                                                                                                                                                                                                 | 
                                                             			if ($useajax == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5640
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5641
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5640
                                                                                                                                                                                                 | 
                                                            +				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5641
                                                                                                                                                                                                 | 
                                                            +				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5642
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5642
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5643
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5643
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5644
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5644
                                                                                                                                                                                                 | 
                                                             			$postconfirmas = 'GET';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5645
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5645
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5646
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5646
                                                                                                                                                                                                 | 
                                                             			$formconfirm .= '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5647
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5647
                                                                                                                                                                                                 | 
                                                                                 resizable: false,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5648
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                    height: "' . $height . '",  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5649
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                    width: "' . $width . '",  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5648
                                                                                                                                                                                                 | 
                                                            +                    height: "' . $height.'",  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5649
                                                                                                                                                                                                 | 
                                                            +                    width: "' . $width.'",  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5650
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5650
                                                                                                                                                                                                 | 
                                                                                 modal: true,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5651
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5651
                                                                                                                                                                                                 | 
                                                                                 closeOnEscape: false,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5652
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5652
                                                                                                                                                                                                 | 
                                                                                 buttons: { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5653
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5654
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							var options = "token=' . urlencode(newToken()) . '";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5655
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                        	var inputok = ' . json_encode($inputok) . ';	/* List of fields into form */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5656
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5657
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5653
                                                                                                                                                                                                 | 
                                                            +                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5654
                                                                                                                                                                                                 | 
                                                            +							var options = "token=' . urlencode(newToken()).'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5655
                                                                                                                                                                                                 | 
                                                            +                        	var inputok = ' . json_encode($inputok).';	/* List of fields into form */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5656
                                                                                                                                                                                                 | 
                                                            +							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5657
                                                                                                                                                                                                 | 
                                                            +                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5658
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5658
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5659
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5659
                                                                                                                                                                                                 | 
                                                                                      	if (inputok.length > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5660
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5660
                                                                                                                                                                                                 | 
                                                                                      		$.each(inputok, function(i, inputname) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5688,11 +5688,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5688
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5688
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5689
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5689
                                                                                                                                                                                                 | 
                                                             	                        $(this).dialog("close"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5690
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5690
                                                                                                                                                                                                 | 
                                                                                     },  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5691
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5692
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                        	var options = "token=' . urlencode(newToken()) . '";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5693
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                         	var inputko = ' . json_encode($inputko) . ';	/* List of fields into form */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5694
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5695
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5691
                                                                                                                                                                                                 | 
                                                            +                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5692
                                                                                                                                                                                                 | 
                                                            +                        	var options = "token=' . urlencode(newToken()).'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5693
                                                                                                                                                                                                 | 
                                                            +                         	var inputko = ' . json_encode($inputko).';	/* List of fields into form */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5694
                                                                                                                                                                                                 | 
                                                            +							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5695
                                                                                                                                                                                                 | 
                                                            +                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5696
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5696
                                                                                                                                                                                                 | 
                                                                                      	if (inputko.length > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5697
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5697
                                                                                                                                                                                                 | 
                                                                                      		$.each(inputko, function(i, inputname) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5698
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5698
                                                                                                                                                                                                 | 
                                                                                      			var more = "";  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5724,10 +5724,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5724
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5724
                                                                                                                                                                                                 | 
                                                                             }  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5725
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5725
                                                                                                                                                                                                 | 
                                                                             );  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5726
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5726
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5727
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -            	var button = "' . $button . '";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5727
                                                                                                                                                                                                 | 
                                                            +            	var button = "' . $button.'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5728
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5728
                                                                                                                                                                                                 | 
                                                                         	if (button.length > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5729
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5729
                                                                                                                                                                                                 | 
                                                                             	$( "#" + button ).click(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5730
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                		$("#' . $dialogconfirm . '").dialog("open"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5730
                                                                                                                                                                                                 | 
                                                            +                		$("#' . $dialogconfirm.'").dialog("open"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5731
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5731
                                                                                                                                                                                                 | 
                                                                     			});  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5732
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5732
                                                                                                                                                                                                 | 
                                                                             }  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5733
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5733
                                                                                                                                                                                                 | 
                                                                         });  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5735,44 +5735,44 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5735
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5735
                                                                                                                                                                                                 | 
                                                                         </script>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5736
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5736
                                                                                                                                                                                                 | 
                                                             			$formconfirm .= "<!-- end ajax formconfirm -->\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5737
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5737
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5738
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5738
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5739
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5739
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5740
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5740
                                                                                                                                                                                                 | 
                                                             			if (empty($disableformtag)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5741
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5741
                                                                                                                                                                                                 | 
                                                            +				$formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5742
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5742
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5743
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5743
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5744
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5745
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5744
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5745
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5746
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5746
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5747
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= '<table class="valid centpercent">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5747
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= '<table class="valid centpercent">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5748
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5748
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5749
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5749
                                                                                                                                                                                                 | 
                                                             			// Line title  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5750
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5750
                                                                                                                                                                                                 | 
                                                             			$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5751
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5752
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= '</td></tr>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5751
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5752
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= '</td></tr>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5753
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5753
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5754
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5754
                                                                                                                                                                                                 | 
                                                             			// Line text  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5755
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5755
                                                                                                                                                                                                 | 
                                                             			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5756
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5756
                                                                                                                                                                                                 | 
                                                            +				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5757
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5757
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5758
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5758
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5759
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5759
                                                                                                                                                                                                 | 
                                                             			// Line form fields  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5760
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5760
                                                                                                                                                                                                 | 
                                                             			if ($more) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5761
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5761
                                                                                                                                                                                                 | 
                                                            +				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5762
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5762
                                                                                                                                                                                                 | 
                                                             				$formconfirm .= $more;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5763
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$formconfirm .= '</td></tr>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5763
                                                                                                                                                                                                 | 
                                                            +				$formconfirm .= '</td></tr>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5764
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5764
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5765
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5765
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5766
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5766
                                                                                                                                                                                                 | 
                                                             			// Line with question  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5767
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5767
                                                                                                                                                                                                 | 
                                                             			$formconfirm .= '<tr class="valid">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5768
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= '<td class="valid">' . $question . '</td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5768
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= '<td class="valid">'.$question.'</td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5769
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5769
                                                                                                                                                                                                 | 
                                                             			$formconfirm .= '<td class="valid center">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5770
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5770
                                                                                                                                                                                                 | 
                                                             			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5771
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5771
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5772
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5772
                                                                                                                                                                                                 | 
                                                             			$formconfirm .= '</td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5773
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= '</tr>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5773
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= '</tr>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5774
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5774
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5775
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$formconfirm .= '</table>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5775
                                                                                                                                                                                                 | 
                                                            +			$formconfirm .= '</table>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5776
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5776
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5777
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5777
                                                                                                                                                                                                 | 
                                                             			if (empty($disableformtag)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5778
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5778
                                                                                                                                                                                                 | 
                                                             				$formconfirm .= "</form>\n";  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5781,7 +5781,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5781
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5781
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5782
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5782
                                                                                                                                                                                                 | 
                                                             			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5783
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5783
                                                                                                                                                                                                 | 
                                                             				$formconfirm .= '<!-- code to disable button to avoid double clic -->';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5784
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5784
                                                                                                                                                                                                 | 
                                                            +				$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5785
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5785
                                                                                                                                                                                                 | 
                                                             				$formconfirm .= '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5786
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5786
                                                                                                                                                                                                 | 
                                                             				$(document).ready(function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5787
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5787
                                                                                                                                                                                                 | 
                                                             					$(".confirmvalidatebutton").on("click", function() { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5793,7 +5793,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5793
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5793
                                                                                                                                                                                                 | 
                                                             					});  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5794
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5794
                                                                                                                                                                                                 | 
                                                             				});  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5795
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5795
                                                                                                                                                                                                 | 
                                                             				';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5796
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$formconfirm .= '</script>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5796
                                                                                                                                                                                                 | 
                                                            +				$formconfirm .= '</script>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5797
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5797
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5798
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5798
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5799
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5799
                                                                                                                                                                                                 | 
                                                             			$formconfirm .= "<!-- end formconfirm -->\n";  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5825,8 +5825,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5825
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5825
                                                                                                                                                                                                 | 
                                                             		// phpcs:enable  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5826
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5826
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5827
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5827
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5828
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5829
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5828
                                                                                                                                                                                                 | 
                                                            +		require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5829
                                                                                                                                                                                                 | 
                                                            +		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5830
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5830
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5831
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5831
                                                                                                                                                                                                 | 
                                                             		$out = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5832
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5832
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5834,11 +5834,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5834
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5834
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5835
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5835
                                                                                                                                                                                                 | 
                                                             		$langs->load("project"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5836
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5836
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5837
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<form method="post" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5837
                                                                                                                                                                                                 | 
                                                            +			$out .= '<form method="post" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5838
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5838
                                                                                                                                                                                                 | 
                                                             			$out .= '<input type="hidden" name="action" value="classin">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5839
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5839
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5840
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5840
                                                                                                                                                                                                 | 
                                                             			$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5841
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5841
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5842
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5842
                                                                                                                                                                                                 | 
                                                             			$out .= '</form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5843
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5843
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5844
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5844
                                                                                                                                                                                                 | 
                                                             			$out .= '<span class="project_head_block">';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5847,7 +5847,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5847
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5847
                                                                                                                                                                                                 | 
                                                             				$projet->fetch($selected);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5848
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5848
                                                                                                                                                                                                 | 
                                                             				$out .= $projet->getNomUrl(0, '', 1);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5849
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5849
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5850
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5850
                                                                                                                                                                                                 | 
                                                            +				$out .= '<span class="opacitymedium">'.$textifnoproject.'</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5851
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5851
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5852
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5852
                                                                                                                                                                                                 | 
                                                             			$out .= '</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5853
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5853
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5884,14 +5884,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5884
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5884
                                                                                                                                                                                                 | 
                                                             		$out = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5885
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5885
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5886
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5886
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5887
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<form method="POST" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5887
                                                                                                                                                                                                 | 
                                                            +			$out .= '<form method="POST" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5888
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5888
                                                                                                                                                                                                 | 
                                                             			$out .= '<input type="hidden" name="action" value="setconditions">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5889
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5889
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5890
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5890
                                                                                                                                                                                                 | 
                                                             			if ($type) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5891
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5891
                                                                                                                                                                                                 | 
                                                            +				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5892
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5892
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5893
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5893
                                                                                                                                                                                                 | 
                                                             			$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5894
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5894
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5895
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5895
                                                                                                                                                                                                 | 
                                                             			$out .= '</form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5896
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5896
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5897
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5897
                                                                                                                                                                                                 | 
                                                             			if ($selected) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5936,12 +5936,12 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5936
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5936
                                                                                                                                                                                                 | 
                                                             		// phpcs:enable  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5937
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5937
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5938
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5938
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5939
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<form method="post" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5939
                                                                                                                                                                                                 | 
                                                            +			print '<form method="post" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5940
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5940
                                                                                                                                                                                                 | 
                                                             			print '<input type="hidden" name="action" value="setavailability">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5941
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5941
                                                                                                                                                                                                 | 
                                                            +			print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5942
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5942
                                                                                                                                                                                                 | 
                                                             			$this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5943
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5944
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5943
                                                                                                                                                                                                 | 
                                                            +			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5944
                                                                                                                                                                                                 | 
                                                            +			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5945
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5945
                                                                                                                                                                                                 | 
                                                             			print '</form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5946
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5946
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5947
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5947
                                                                                                                                                                                                 | 
                                                             			if ($selected) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -5967,11 +5967,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    5967
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5967
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5968
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5968
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5969
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5969
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5970
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<form method="post" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5970
                                                                                                                                                                                                 | 
                                                            +			print '<form method="post" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5971
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5971
                                                                                                                                                                                                 | 
                                                             			print '<input type="hidden" name="action" value="setdemandreason">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5972
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5972
                                                                                                                                                                                                 | 
                                                            +			print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5973
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5973
                                                                                                                                                                                                 | 
                                                             			$this->selectInputReason($selected, $htmlname, -1, $addempty);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5974
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    5974
                                                                                                                                                                                                 | 
                                                            +			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5975
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5975
                                                                                                                                                                                                 | 
                                                             			print '</form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5976
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5976
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    5977
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    5977
                                                                                                                                                                                                 | 
                                                             			if ($selected) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6011,17 +6011,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6011
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6011
                                                                                                                                                                                                 | 
                                                             		$ret = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6012
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6012
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6013
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6013
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6014
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6015
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6016
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6014
                                                                                                                                                                                                 | 
                                                            +			$ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6015
                                                                                                                                                                                                 | 
                                                            +			$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6016
                                                                                                                                                                                                 | 
                                                            +			$ret .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6017
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6017
                                                                                                                                                                                                 | 
                                                             			if ($type) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6018
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6018
                                                                                                                                                                                                 | 
                                                            +				$ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6019
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6019
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6020
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6020
                                                                                                                                                                                                 | 
                                                             			$ret .= '<table class="nobordernopadding">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6021
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6021
                                                                                                                                                                                                 | 
                                                             			$ret .= '<tr><td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6022
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6022
                                                                                                                                                                                                 | 
                                                            +			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6023
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6023
                                                                                                                                                                                                 | 
                                                             			$ret .= '</td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6024
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6024
                                                                                                                                                                                                 | 
                                                            +			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6025
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6025
                                                                                                                                                                                                 | 
                                                             			$ret .= '</tr></table></form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6026
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6026
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6027
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6027
                                                                                                                                                                                                 | 
                                                             			if ($displayhour) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6056,15 +6056,15 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6056
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6056
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6057
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6057
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6058
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6058
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6059
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6060
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="hidden" name="action" value="set' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6061
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6059
                                                                                                                                                                                                 | 
                                                            +			print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6060
                                                                                                                                                                                                 | 
                                                            +			print '<input type="hidden" name="action" value="set'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6061
                                                                                                                                                                                                 | 
                                                            +			print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6062
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6062
                                                                                                                                                                                                 | 
                                                             			print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6063
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6063
                                                                                                                                                                                                 | 
                                                            +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6064
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6064
                                                                                                                                                                                                 | 
                                                             			print '</form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6065
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6065
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6066
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6066
                                                                                                                                                                                                 | 
                                                             			if ($selected) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6067
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6067
                                                                                                                                                                                                 | 
                                                            +				require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6068
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6068
                                                                                                                                                                                                 | 
                                                             				$theuser = new User($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6069
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6069
                                                                                                                                                                                                 | 
                                                             				$theuser->fetch($selected);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6070
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6070
                                                                                                                                                                                                 | 
                                                             				print $theuser->getNomUrl(1);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6097,14 +6097,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6097
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6097
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6098
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6098
                                                                                                                                                                                                 | 
                                                             		$out = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6099
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6099
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6100
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<form method="POST" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6100
                                                                                                                                                                                                 | 
                                                            +			$out .= '<form method="POST" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6101
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6101
                                                                                                                                                                                                 | 
                                                             			$out .= '<input type="hidden" name="action" value="setmode">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6102
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6102
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6103
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6103
                                                                                                                                                                                                 | 
                                                             			if ($type) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6104
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6104
                                                                                                                                                                                                 | 
                                                            +				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6105
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6105
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6106
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6106
                                                                                                                                                                                                 | 
                                                             			$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6107
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6107
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6108
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6108
                                                                                                                                                                                                 | 
                                                             			$out .= '</form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6109
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6109
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6110
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6110
                                                                                                                                                                                                 | 
                                                             			if ($selected) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6137,11 +6137,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6137
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6137
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6138
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6138
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6139
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6139
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6140
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<form method="POST" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6140
                                                                                                                                                                                                 | 
                                                            +			print '<form method="POST" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6141
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6141
                                                                                                                                                                                                 | 
                                                             			print '<input type="hidden" name="action" value="settransportmode">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6142
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6142
                                                                                                                                                                                                 | 
                                                            +			print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6143
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6143
                                                                                                                                                                                                 | 
                                                             			$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6144
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6144
                                                                                                                                                                                                 | 
                                                            +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6145
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6145
                                                                                                                                                                                                 | 
                                                             			print '</form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6146
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6146
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6147
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6147
                                                                                                                                                                                                 | 
                                                             			if ($selected) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6168,14 +6168,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6168
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6168
                                                                                                                                                                                                 | 
                                                             		// phpcs:enable  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6169
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6169
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6170
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6170
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6171
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<form method="POST" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6171
                                                                                                                                                                                                 | 
                                                            +			print '<form method="POST" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6172
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6172
                                                                                                                                                                                                 | 
                                                             			print '<input type="hidden" name="action" value="setmulticurrencycode">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6173
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6173
                                                                                                                                                                                                 | 
                                                            +			print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6174
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6174
                                                                                                                                                                                                 | 
                                                             			print $this->selectMultiCurrency($selected, $htmlname, 0);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6175
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6175
                                                                                                                                                                                                 | 
                                                            +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6176
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6176
                                                                                                                                                                                                 | 
                                                             			print '</form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6177
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6177
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6178
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6178
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6179
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6179
                                                                                                                                                                                                 | 
                                                             			print !empty($selected) ? currency_name($selected, 1) : ' ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6180
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6180
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6181
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6181
                                                                                                                                                                                                 | 
                                                             	}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6197,21 +6197,21 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6197
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6197
                                                                                                                                                                                                 | 
                                                             		global $langs, $mysoc, $conf;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6198
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6198
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6199
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6199
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6200
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<form method="POST" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6200
                                                                                                                                                                                                 | 
                                                            +			print '<form method="POST" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6201
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6201
                                                                                                                                                                                                 | 
                                                             			print '<input type="hidden" name="action" value="setmulticurrencyrate">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6202
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6203
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6202
                                                                                                                                                                                                 | 
                                                            +			print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6203
                                                                                                                                                                                                 | 
                                                            +			print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6204
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6204
                                                                                                                                                                                                 | 
                                                             			print '<select name="calculation_mode">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6205
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6206
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6205
                                                                                                                                                                                                 | 
                                                            +			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6206
                                                                                                                                                                                                 | 
                                                            +			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6207
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6207
                                                                                                                                                                                                 | 
                                                             			print '</select> ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6208
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6208
                                                                                                                                                                                                 | 
                                                            +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6209
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6209
                                                                                                                                                                                                 | 
                                                             			print '</form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6210
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6210
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6211
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6211
                                                                                                                                                                                                 | 
                                                             			if (!empty($rate)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6212
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6212
                                                                                                                                                                                                 | 
                                                             				print price($rate, 1, $langs, 0, 0);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6213
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6213
                                                                                                                                                                                                 | 
                                                             				if ($currency && $rate != 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6214
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '   (' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6214
                                                                                                                                                                                                 | 
                                                            +					print '   ('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6215
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6215
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6216
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6216
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6217
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6217
                                                                                                                                                                                                 | 
                                                             				print 1;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6242,9 +6242,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6242
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6242
                                                                                                                                                                                                 | 
                                                             		// phpcs:enable  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6243
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6243
                                                                                                                                                                                                 | 
                                                             		global $conf, $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6244
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6244
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6245
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<form method="post" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6245
                                                                                                                                                                                                 | 
                                                            +			print '<form method="post" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6246
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6246
                                                                                                                                                                                                 | 
                                                             			print '<input type="hidden" name="action" value="setabsolutediscount">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6247
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6247
                                                                                                                                                                                                 | 
                                                            +			print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6248
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6248
                                                                                                                                                                                                 | 
                                                             			print '<div class="inline-block">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6249
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6249
                                                                                                                                                                                                 | 
                                                             			if (!empty($discount_type)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6250
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6250
                                                                                                                                                                                                 | 
                                                             				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6282,24 +6282,24 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6282
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6282
                                                                                                                                                                                                 | 
                                                             			print '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6283
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6283
                                                                                                                                                                                                 | 
                                                             			if (empty($hidelist)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6284
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6284
                                                                                                                                                                                                 | 
                                                             				print '<div class="inline-block" style="padding-right: 10px">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6285
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$newfilter = 'discount_type=' . intval($discount_type);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6285
                                                                                                                                                                                                 | 
                                                            +				$newfilter = 'discount_type='.intval($discount_type);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6286
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6286
                                                                                                                                                                                                 | 
                                                             				if (!empty($discount_type)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6287
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6287
                                                                                                                                                                                                 | 
                                                             					$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6288
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6288
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6289
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6289
                                                                                                                                                                                                 | 
                                                             					$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6290
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6290
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6291
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6291
                                                                                                                                                                                                 | 
                                                             				if ($filter) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6292
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$newfilter .= ' AND (' . $filter . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6292
                                                                                                                                                                                                 | 
                                                            +					$newfilter .= ' AND ('.$filter.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6293
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6293
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6294
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6294
                                                                                                                                                                                                 | 
                                                             				// output the combo of discounts  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6295
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6295
                                                                                                                                                                                                 | 
                                                             				$nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6296
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6296
                                                                                                                                                                                                 | 
                                                             				if ($nbqualifiedlines > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6297
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '   <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6297
                                                                                                                                                                                                 | 
                                                            +					print '   <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6298
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6298
                                                                                                                                                                                                 | 
                                                             					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6299
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6299
                                                                                                                                                                                                 | 
                                                            +						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6300
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6300
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6301
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6301
                                                                                                                                                                                                 | 
                                                             					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6302
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6302
                                                                                                                                                                                                 | 
                                                            +						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6303
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6303
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6304
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6304
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6305
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6305
                                                                                                                                                                                                 | 
                                                             					print '>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6339,23 +6339,23 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6339
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6339
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6340
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6340
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6341
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6341
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6342
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<form method="post" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6342
                                                                                                                                                                                                 | 
                                                            +			print '<form method="post" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6343
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6343
                                                                                                                                                                                                 | 
                                                             			print '<input type="hidden" name="action" value="set_contact">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6344
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6344
                                                                                                                                                                                                 | 
                                                            +			print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6345
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6345
                                                                                                                                                                                                 | 
                                                             			print '<table class="nobordernopadding">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6346
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6346
                                                                                                                                                                                                 | 
                                                             			print '<tr><td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6347
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6347
                                                                                                                                                                                                 | 
                                                             			print $this->selectcontacts($societe->id, $selected, $htmlname);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6348
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6348
                                                                                                                                                                                                 | 
                                                             			$num = $this->num;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6349
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6349
                                                                                                                                                                                                 | 
                                                             			if ($num == 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6350
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6350
                                                                                                                                                                                                 | 
                                                             				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6351
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6351
                                                                                                                                                                                                 | 
                                                            +				print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6352
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6352
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6353
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6353
                                                                                                                                                                                                 | 
                                                             			print '</td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6354
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6354
                                                                                                                                                                                                 | 
                                                            +			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6355
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6355
                                                                                                                                                                                                 | 
                                                             			print '</tr></table></form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6356
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6356
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6357
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6357
                                                                                                                                                                                                 | 
                                                             			if ($selected) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6358
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6358
                                                                                                                                                                                                 | 
                                                            +				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6359
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6359
                                                                                                                                                                                                 | 
                                                             				$contact = new Contact($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6360
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6360
                                                                                                                                                                                                 | 
                                                             				$contact->fetch($selected);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6361
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6361
                                                                                                                                                                                                 | 
                                                             				print $contact->getFullName($langs);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6390,20 +6390,20 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6390
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6390
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6391
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6391
                                                                                                                                                                                                 | 
                                                             		$out = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6392
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6392
                                                                                                                                                                                                 | 
                                                             		if ($htmlname != "none") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6393
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<form method="post" action="' . $page . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6393
                                                                                                                                                                                                 | 
                                                            +			$out .= '<form method="post" action="'.$page.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6394
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6394
                                                                                                                                                                                                 | 
                                                             			$out .= '<input type="hidden" name="action" value="set_thirdparty">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6395
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6395
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6396
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6396
                                                                                                                                                                                                 | 
                                                             			$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6397
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6397
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6398
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6398
                                                                                                                                                                                                 | 
                                                             			$out .= '</form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6399
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6399
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6400
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6400
                                                                                                                                                                                                 | 
                                                             			if ($selected) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6401
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6401
                                                                                                                                                                                                 | 
                                                            +				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6402
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6402
                                                                                                                                                                                                 | 
                                                             				$soc = new Societe($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6403
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6403
                                                                                                                                                                                                 | 
                                                             				$soc->fetch($selected);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6404
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6404
                                                                                                                                                                                                 | 
                                                             				$out .= $soc->getNomUrl(0, '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6405
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6405
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6406
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6406
                                                                                                                                                                                                 | 
                                                            +				$out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6407
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6407
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6408
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6408
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6409
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6409
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6453,22 +6453,22 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6453
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6453
                                                                                                                                                                                                 | 
                                                             			$selected = 'EUR'; // Pour compatibilite  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6454
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6454
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6455
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6455
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6456
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6456
                                                                                                                                                                                                 | 
                                                            +		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6457
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6457
                                                                                                                                                                                                 | 
                                                             		if ($useempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6458
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6458
                                                                                                                                                                                                 | 
                                                             			$out .= '<option value="-1" selected></option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6459
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6459
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6460
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6460
                                                                                                                                                                                                 | 
                                                             		foreach ($langs->cache_currencies as $code_iso => $currency) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6461
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6461
                                                                                                                                                                                                 | 
                                                             			$labeltoshow = $currency['label'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6462
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6462
                                                                                                                                                                                                 | 
                                                             			if ($mode == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6463
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6463
                                                                                                                                                                                                 | 
                                                            +				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6464
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6464
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6465
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6465
                                                                                                                                                                                                 | 
                                                            +				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6466
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6466
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6467
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6467
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6468
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6468
                                                                                                                                                                                                 | 
                                                             			if ($selected && $selected == $code_iso) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6469
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6469
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6470
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6470
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6471
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6471
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6472
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6472
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6473
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6473
                                                                                                                                                                                                 | 
                                                             			$out .= $labeltoshow;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6474
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6474
                                                                                                                                                                                                 | 
                                                             			$out .= '</option>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6479,7 +6479,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6479
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6479
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6480
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6480
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6481
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6481
                                                                                                                                                                                                 | 
                                                             		// Make select dynamic  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6482
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6482
                                                                                                                                                                                                 | 
                                                            +		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6483
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6483
                                                                                                                                                                                                 | 
                                                             		$out .= ajax_combobox($htmlname);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6484
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6484
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6485
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6485
                                                                                                                                                                                                 | 
                                                             		return $out;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6505,10 +6505,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6505
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6505
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6506
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6506
                                                                                                                                                                                                 | 
                                                             		$TCurrency = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6507
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6507
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6508
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6509
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6508
                                                                                                                                                                                                 | 
                                                            +		$sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6509
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6510
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6510
                                                                                                                                                                                                 | 
                                                             		if ($filter) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6511
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND " . $filter;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6511
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND ".$filter;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6512
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6512
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6513
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6513
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6514
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6514
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6518,7 +6518,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6518
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6518
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6519
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6519
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6520
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6520
                                                                                                                                                                                                 | 
                                                             		$out = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6521
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6521
                                                                                                                                                                                                 | 
                                                            +		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6522
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6522
                                                                                                                                                                                                 | 
                                                             		if ($useempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6523
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6523
                                                                                                                                                                                                 | 
                                                             			$out .= '<option value=""> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6524
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6524
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6530,13 +6530,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6530
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6530
                                                                                                                                                                                                 | 
                                                             			foreach ($langs->cache_currencies as $code_iso => $currency) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6531
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6531
                                                                                                                                                                                                 | 
                                                             				if (isset($TCurrency[$code_iso])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6532
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6532
                                                                                                                                                                                                 | 
                                                             					if (!empty($selected) && $selected == $code_iso) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6533
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '<option value="' . $code_iso . '" selected="selected">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6533
                                                                                                                                                                                                 | 
                                                            +						$out .= '<option value="'.$code_iso.'" selected="selected">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6534
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6534
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6535
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '<option value="' . $code_iso . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6535
                                                                                                                                                                                                 | 
                                                            +						$out .= '<option value="'.$code_iso.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6536
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6536
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6537
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6537
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6538
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6538
                                                                                                                                                                                                 | 
                                                             					$out .= $currency['label'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6539
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6539
                                                                                                                                                                                                 | 
                                                            +					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6540
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6540
                                                                                                                                                                                                 | 
                                                             					$out .= '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6541
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6541
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6542
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6542
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6545,7 +6545,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6545
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6545
                                                                                                                                                                                                 | 
                                                             		$out .= '</select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6546
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6546
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6547
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6547
                                                                                                                                                                                                 | 
                                                             		// Make select dynamic  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6548
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6548
                                                                                                                                                                                                 | 
                                                            +		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6549
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6549
                                                                                                                                                                                                 | 
                                                             		$out .= ajax_combobox($htmlname);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6550
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6550
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6551
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6551
                                                                                                                                                                                                 | 
                                                             		return $out;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6576,7 +6576,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6576
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6576
                                                                                                                                                                                                 | 
                                                             		$sql .= " WHERE t.fk_pays = c.rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6577
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6577
                                                                                                                                                                                                 | 
                                                             		$sql .= " AND t.active > 0";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6578
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6578
                                                                                                                                                                                                 | 
                                                             		$sql .= " AND t.entity IN (".getEntity('c_tva').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6579
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6579
                                                                                                                                                                                                 | 
                                                            +		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6580
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6580
                                                                                                                                                                                                 | 
                                                             		$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6581
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6581
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6582
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6582
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6588,30 +6588,30 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6588
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6588
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6589
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6589
                                                                                                                                                                                                 | 
                                                             					$tmparray = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6590
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6590
                                                                                                                                                                                                 | 
                                                             					$tmparray['rowid']			= $obj->rowid;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6591
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$tmparray['type_vat']		= $obj->type_vat;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6592
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$tmparray['code']			= $obj->code;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6591
                                                                                                                                                                                                 | 
                                                            +					$tmparray['type_vat'] = $obj->type_vat;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6592
                                                                                                                                                                                                 | 
                                                            +					$tmparray['code'] = $obj->code;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6593
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6593
                                                                                                                                                                                                 | 
                                                             					$tmparray['txtva']			= $obj->taux;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6594
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$tmparray['nprtva']			= $obj->recuperableonly;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6594
                                                                                                                                                                                                 | 
                                                            +					$tmparray['nprtva'] = $obj->recuperableonly;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6595
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6595
                                                                                                                                                                                                 | 
                                                             					$tmparray['localtax1']	    = $obj->localtax1;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6596
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6596
                                                                                                                                                                                                 | 
                                                             					$tmparray['localtax1_type']	= $obj->localtax1_type;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6597
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6597
                                                                                                                                                                                                 | 
                                                             					$tmparray['localtax2']	    = $obj->localtax2;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6598
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6598
                                                                                                                                                                                                 | 
                                                             					$tmparray['localtax2_type']	= $obj->localtax1_type;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6599
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$tmparray['label']			= $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6600
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$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 | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6599
                                                                                                                                                                                                 | 
                                                            +					$tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6600
                                                                                                                                                                                                 | 
                                                            +					$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 | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6601
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6601
                                                                                                                                                                                                 | 
                                                             					$positiverates = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6602
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6602
                                                                                                                                                                                                 | 
                                                             					if ($obj->taux) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6603
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$positiverates .= ($positiverates ? '/' : '') . $obj->taux;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6603
                                                                                                                                                                                                 | 
                                                            +						$positiverates .= ($positiverates ? '/' : '').$obj->taux;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6604
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6604
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6605
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6605
                                                                                                                                                                                                 | 
                                                             					if ($obj->localtax1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6606
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6606
                                                                                                                                                                                                 | 
                                                            +						$positiverates .= ($positiverates ? '/' : '').$obj->localtax1;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6607
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6607
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6608
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6608
                                                                                                                                                                                                 | 
                                                             					if ($obj->localtax2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6609
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6609
                                                                                                                                                                                                 | 
                                                            +						$positiverates .= ($positiverates ? '/' : '').$obj->localtax2;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6610
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6610
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6611
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6611
                                                                                                                                                                                                 | 
                                                             					if (empty($positiverates)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6612
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6612
                                                                                                                                                                                                 | 
                                                             						$positiverates = '0';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6613
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6613
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6614
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6614
                                                                                                                                                                                                 | 
                                                            +					$tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6615
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6615
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6616
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6616
                                                                                                                                                                                                 | 
                                                             					$this->cache_vatrates[$obj->rowid] = $tmparray;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6617
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6617
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6631,7 +6631,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6631
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6631
                                                                                                                                                                                                 | 
                                                             				return -1;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6632
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6632
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6633
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6633
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6634
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$this->error = '<span class="error">' . $this->db->error() . '</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6634
                                                                                                                                                                                                 | 
                                                            +			$this->error = '<span class="error">'.$this->db->error().'</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6635
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6635
                                                                                                                                                                                                 | 
                                                             			return -2;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6636
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6636
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6637
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6637
                                                                                                                                                                                                 | 
                                                             	}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6684,9 +6684,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6684
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6684
                                                                                                                                                                                                 | 
                                                             		// Check parameters  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6685
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6685
                                                                                                                                                                                                 | 
                                                             		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6686
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6686
                                                                                                                                                                                                 | 
                                                             			if ($societe_vendeuse->id == $mysoc->id) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6687
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6687
                                                                                                                                                                                                 | 
                                                            +				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6688
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6688
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6689
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6689
                                                                                                                                                                                                 | 
                                                            +				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6690
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6690
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6691
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6691
                                                                                                                                                                                                 | 
                                                             			return $return;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6692
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6692
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6698,12 +6698,12 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6698
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6698
                                                                                                                                                                                                 | 
                                                             		// Define list of countries to use to search VAT rates to show  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6699
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6699
                                                                                                                                                                                                 | 
                                                             		// First we defined code_country to use to find list  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6700
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6700
                                                                                                                                                                                                 | 
                                                             		if (is_object($societe_vendeuse)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6701
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$code_country = "'" . $societe_vendeuse->country_code . "'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6701
                                                                                                                                                                                                 | 
                                                            +			$code_country = "'".$societe_vendeuse->country_code."'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6702
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6702
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6703
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6703
                                                                                                                                                                                                 | 
                                                            +			$code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6704
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6704
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6705
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6705
                                                                                                                                                                                                 | 
                                                             		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6706
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6706
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6707
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6707
                                                                                                                                                                                                 | 
                                                             			// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6708
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6708
                                                                                                                                                                                                 | 
                                                             			// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6709
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6709
                                                                                                                                                                                                 | 
                                                             			$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6713,27 +6713,27 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6713
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6713
                                                                                                                                                                                                 | 
                                                             					if ($type == 1) { // We know product is a service | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6714
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6714
                                                                                                                                                                                                 | 
                                                             						switch ($selectVatComboMode) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6715
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6715
                                                                                                                                                                                                 | 
                                                             							case '1':  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6716
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6716
                                                                                                                                                                                                 | 
                                                            +								$code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6717
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6717
                                                                                                                                                                                                 | 
                                                             								break;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6718
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6718
                                                                                                                                                                                                 | 
                                                             							case '2':  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6719
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$code_country = "'" . $societe_acheteuse->country_code . "'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6719
                                                                                                                                                                                                 | 
                                                            +								$code_country = "'".$societe_acheteuse->country_code."'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6720
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6720
                                                                                                                                                                                                 | 
                                                             								break;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6721
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6721
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6722
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6722
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6723
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6723
                                                                                                                                                                                                 | 
                                                             				} elseif (!$idprod) {  // We don't know type of product | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6724
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6724
                                                                                                                                                                                                 | 
                                                             					switch ($selectVatComboMode) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6725
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6725
                                                                                                                                                                                                 | 
                                                             						case '1':  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6726
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6726
                                                                                                                                                                                                 | 
                                                            +							$code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6727
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6727
                                                                                                                                                                                                 | 
                                                             							break;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6728
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6728
                                                                                                                                                                                                 | 
                                                             						case '2':  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6729
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$code_country = "'" . $societe_acheteuse->country_code . "'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6729
                                                                                                                                                                                                 | 
                                                            +							$code_country = "'".$societe_acheteuse->country_code."'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6730
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6730
                                                                                                                                                                                                 | 
                                                             							break;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6731
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6731
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6732
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6732
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6733
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6733
                                                                                                                                                                                                 | 
                                                             					$prodstatic = new Product($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6734
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6734
                                                                                                                                                                                                 | 
                                                             					$prodstatic->fetch($idprod);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6735
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6735
                                                                                                                                                                                                 | 
                                                             					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6736
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6736
                                                                                                                                                                                                 | 
                                                            +						$code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6737
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6737
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6738
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6738
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6739
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6739
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6795,13 +6795,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6795
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6795
                                                                                                                                                                                                 | 
                                                             				// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6796
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6796
                                                                                                                                                                                                 | 
                                                             				// of using supplier invoices (this is a very bad idea !)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6797
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6797
                                                                                                                                                                                                 | 
                                                             				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6798
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6798
                                                                                                                                                                                                 | 
                                                            +					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6799
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6799
                                                                                                                                                                                                 | 
                                                             					$disabled = true;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6800
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6800
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6801
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6801
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6802
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6802
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6803
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6803
                                                                                                                                                                                                 | 
                                                             			if (!$options_only) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6804
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6804
                                                                                                                                                                                                 | 
                                                            +				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6805
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6805
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6806
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6806
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6807
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6807
                                                                                                                                                                                                 | 
                                                             			$selectedfound = false;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6815,13 +6815,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6815
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6815
                                                                                                                                                                                                 | 
                                                             				$key = $rate['txtva'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6816
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6816
                                                                                                                                                                                                 | 
                                                             				$key .= $rate['nprtva'] ? '*' : '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6817
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6817
                                                                                                                                                                                                 | 
                                                             				if ($mode > 0 && $rate['code']) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6818
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$key .= ' (' . $rate['code'] . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6818
                                                                                                                                                                                                 | 
                                                            +					$key .= ' ('.$rate['code'].')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6819
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6819
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6820
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6820
                                                                                                                                                                                                 | 
                                                             				if ($mode < 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6821
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6821
                                                                                                                                                                                                 | 
                                                             					$key = $rate['rowid'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6822
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6822
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6823
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6823
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6824
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$return .= '<option value="' . $key . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6824
                                                                                                                                                                                                 | 
                                                            +				$return .= '<option value="'.$key.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6825
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6825
                                                                                                                                                                                                 | 
                                                             				if (!$selectedfound) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6826
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6826
                                                                                                                                                                                                 | 
                                                             					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6827
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6827
                                                                                                                                                                                                 | 
                                                             						if ($defaultcode == $rate['code']) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6892,7 +6892,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6892
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6892
                                                                                                                                                                                                 | 
                                                             	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 = '')  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6893
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6893
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6894
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6894
                                                                                                                                                                                                 | 
                                                             		// phpcs:enable  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6895
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6895
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6896
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6896
                                                                                                                                                                                                 | 
                                                             		$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6897
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6897
                                                                                                                                                                                                 | 
                                                             		if (!empty($nooutput)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6898
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6898
                                                                                                                                                                                                 | 
                                                             			return $retstring;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6921,11 +6921,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6921
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6921
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6922
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6922
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6923
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6923
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6924
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6924
                                                                                                                                                                                                 | 
                                                            +		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6925
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6925
                                                                                                                                                                                                 | 
                                                             		if ($forcenewline) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6926
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6926
                                                                                                                                                                                                 | 
                                                             			$ret .= '<br>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6927
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6927
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6928
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6928
                                                                                                                                                                                                 | 
                                                            +		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6929
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6929
                                                                                                                                                                                                 | 
                                                             		return $ret;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6930
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6930
                                                                                                                                                                                                 | 
                                                             	}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6931
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6931
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -6991,7 +6991,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    6991
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6991
                                                                                                                                                                                                 | 
                                                             		$orig_set_time = $set_time;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6992
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6992
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6993
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6993
                                                                                                                                                                                                 | 
                                                             		if ($set_time === '' && $emptydate == 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6994
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    6994
                                                                                                                                                                                                 | 
                                                            +			include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6995
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6995
                                                                                                                                                                                                 | 
                                                             			if ($gm == 'tzuser' || $gm == 'tzuserrel') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6996
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6996
                                                                                                                                                                                                 | 
                                                             				$set_time = dol_now($gm);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    6997
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    6997
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7063,38 +7063,38 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7063
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7063
                                                                                                                                                                                                 | 
                                                             				// Calendrier popup version eldy  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7064
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7064
                                                                                                                                                                                                 | 
                                                             				if ($usecalendar == "eldy") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7065
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7065
                                                                                                                                                                                                 | 
                                                             					// Input area to enter date manually  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7066
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate" maxlength="11" value="' . $formated_date . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7066
                                                                                                                                                                                                 | 
                                                            +					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7067
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7067
                                                                                                                                                                                                 | 
                                                             					$retstring .= ($disabled ? ' disabled' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7068
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7068
                                                                                                                                                                                                 | 
                                                            +					$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7069
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7069
                                                                                                                                                                                                 | 
                                                             					$retstring .= ' autocomplete="off">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7070
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7070
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7071
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7071
                                                                                                                                                                                                 | 
                                                             					// Icon calendar  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7072
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7072
                                                                                                                                                                                                 | 
                                                             					$retstringbuttom = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7073
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7073
                                                                                                                                                                                                 | 
                                                             					if (!$disabled) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7074
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7075
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$base = DOL_URL_ROOT . '/core/';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7076
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7077
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7074
                                                                                                                                                                                                 | 
                                                            +						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7075
                                                                                                                                                                                                 | 
                                                            +						$base = DOL_URL_ROOT.'/core/';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7076
                                                                                                                                                                                                 | 
                                                            +						$retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7077
                                                                                                                                                                                                 | 
                                                            +						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7078
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7078
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7079
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7079
                                                                                                                                                                                                 | 
                                                            +						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7080
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7080
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7081
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring = $retstringbuttom . $retstring;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7081
                                                                                                                                                                                                 | 
                                                            +					$retstring = $retstringbuttom.$retstring;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7082
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7082
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7083
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7084
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7085
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7083
                                                                                                                                                                                                 | 
                                                            +					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7084
                                                                                                                                                                                                 | 
                                                            +					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7085
                                                                                                                                                                                                 | 
                                                            +					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7086
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7086
                                                                                                                                                                                                 | 
                                                             				} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7087
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7087
                                                                                                                                                                                                 | 
                                                             					if (!$disabled && $usecalendar != 'html') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7088
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7088
                                                                                                                                                                                                 | 
                                                             						// Output javascript for datepicker  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7089
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7089
                                                                                                                                                                                                 | 
                                                             						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100)); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7090
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7090
                                                                                                                                                                                                 | 
                                                             						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100)); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7091
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7091
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7092
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7093
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7094
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7092
                                                                                                                                                                                                 | 
                                                            +						$retstring .= '<script nonce="'.getNonce().'" type="text/javascript">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7093
                                                                                                                                                                                                 | 
                                                            +						$retstring .= "$(function(){ $('#".$prefix."').datepicker({ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7094
                                                                                                                                                                                                 | 
                                                            +							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7095
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7095
                                                                                                                                                                                                 | 
                                                             							autoclose: true,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7096
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7096
                                                                                                                                                                                                 | 
                                                             							todayHighlight: true,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7097
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							yearRange: '" . $minYear . ":" . $maxYear . "',";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7097
                                                                                                                                                                                                 | 
                                                            +							yearRange: '" . $minYear.":".$maxYear."',";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7098
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7098
                                                                                                                                                                                                 | 
                                                             						if (!empty($conf->dol_use_jmobile)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7099
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7099
                                                                                                                                                                                                 | 
                                                             							$retstring .= "  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7100
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7100
                                                                                                                                                                                                 | 
                                                             								beforeShow: function (input, datePicker) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7109,7 +7109,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7109
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7109
                                                                                                                                                                                                 | 
                                                             						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7110
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7110
                                                                                                                                                                                                 | 
                                                             							$retstring .= "  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7111
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7111
                                                                                                                                                                                                 | 
                                                             								showOn: 'button',	/* both has problem with autocompletion */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7112
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7112
                                                                                                                                                                                                 | 
                                                            +								buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7113
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7113
                                                                                                                                                                                                 | 
                                                             								buttonImageOnly: true";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7114
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7114
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7115
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7115
                                                                                                                                                                                                 | 
                                                             						$retstring .= "  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7121,46 +7121,46 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7121
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7121
                                                                                                                                                                                                 | 
                                                             					$retstring .= '<div class="nowraponall inline-block divfordateinput">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7122
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7122
                                                                                                                                                                                                 | 
                                                             					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7123
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7123
                                                                                                                                                                                                 | 
                                                             					$retstring .= ($disabled ? ' disabled' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7124
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7125
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7124
                                                                                                                                                                                                 | 
                                                            +					$retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7125
                                                                                                                                                                                                 | 
                                                            +					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7126
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7126
                                                                                                                                                                                                 | 
                                                             					$retstring .= ' autocomplete="off">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7127
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7127
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7128
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7128
                                                                                                                                                                                                 | 
                                                             					// Icone calendrier  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7129
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7129
                                                                                                                                                                                                 | 
                                                             					if ($disabled) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7130
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7131
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$retstring = $retstringbutton . $retstring;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7130
                                                                                                                                                                                                 | 
                                                            +						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7131
                                                                                                                                                                                                 | 
                                                            +						$retstring = $retstringbutton.$retstring;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7132
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7132
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7133
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7133
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7134
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7134
                                                                                                                                                                                                 | 
                                                             					$retstring .= '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7135
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7136
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7137
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7135
                                                                                                                                                                                                 | 
                                                            +					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7136
                                                                                                                                                                                                 | 
                                                            +					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7137
                                                                                                                                                                                                 | 
                                                            +					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7138
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7138
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7139
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7139
                                                                                                                                                                                                 | 
                                                             					$retstring .= "Bad value of MAIN_POPUP_CALENDAR";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7140
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7140
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7141
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7141
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7142
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7142
                                                                                                                                                                                                 | 
                                                             				// Show date with combo selects  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7143
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7143
                                                                                                                                                                                                 | 
                                                             				// Day  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7144
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7144
                                                                                                                                                                                                 | 
                                                            +				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7145
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7145
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7146
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7146
                                                                                                                                                                                                 | 
                                                             				if ($emptydate || $set_time == -1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7147
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7147
                                                                                                                                                                                                 | 
                                                             					$retstring .= '<option value="0" selected> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7148
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7148
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7149
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7149
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7150
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7150
                                                                                                                                                                                                 | 
                                                             				for ($day = 1; $day <= 31; $day++) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7151
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7151
                                                                                                                                                                                                 | 
                                                            +					$retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7152
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7152
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7153
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7153
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7154
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7154
                                                                                                                                                                                                 | 
                                                             				$retstring .= "</select>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7155
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7155
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7156
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7156
                                                                                                                                                                                                 | 
                                                            +				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7157
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7157
                                                                                                                                                                                                 | 
                                                             				if ($emptydate || $set_time == -1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7158
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7158
                                                                                                                                                                                                 | 
                                                             					$retstring .= '<option value="0" selected> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7159
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7159
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7160
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7160
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7161
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7161
                                                                                                                                                                                                 | 
                                                             				// Month  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7162
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7162
                                                                                                                                                                                                 | 
                                                             				for ($month = 1; $month <= 12; $month++) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7163
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7163
                                                                                                                                                                                                 | 
                                                            +					$retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7164
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7164
                                                                                                                                                                                                 | 
                                                             					$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7165
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7165
                                                                                                                                                                                                 | 
                                                             					$retstring .= "</option>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7166
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7166
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7168,13 +7168,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7168
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7168
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7169
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7169
                                                                                                                                                                                                 | 
                                                             				// Year  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7170
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7170
                                                                                                                                                                                                 | 
                                                             				if ($emptydate || $set_time == -1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7171
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$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 . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7171
                                                                                                                                                                                                 | 
                                                            +					$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.'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7172
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7172
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7173
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7173
                                                                                                                                                                                                 | 
                                                            +					$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7174
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7174
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7175
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7175
                                                                                                                                                                                                 | 
                                                             					$syear = (int) $syear;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7176
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7176
                                                                                                                                                                                                 | 
                                                             					for ($year = $syear - 10; $year < (int) $syear + 10; $year++) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7177
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7177
                                                                                                                                                                                                 | 
                                                            +						$retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7178
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7178
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7179
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7179
                                                                                                                                                                                                 | 
                                                             					$retstring .= "</select>\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7180
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7180
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7198,15 +7198,15 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7198
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7198
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7199
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7199
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7200
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7200
                                                                                                                                                                                                 | 
                                                             			// Show hour  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7201
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7201
                                                                                                                                                                                                 | 
                                                            +			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7202
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7202
                                                                                                                                                                                                 | 
                                                             			if ($emptyhours) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7203
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7203
                                                                                                                                                                                                 | 
                                                             				$retstring .= '<option value="-1"> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7204
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7204
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7205
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7205
                                                                                                                                                                                                 | 
                                                             			for ($hour = $hourstart; $hour < $hourend; $hour++) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7206
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7206
                                                                                                                                                                                                 | 
                                                             				if (strlen($hour) < 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7207
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$hour = "0" . $hour;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7207
                                                                                                                                                                                                 | 
                                                            +					$hour = "0".$hour;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7208
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7208
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7209
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7209
                                                                                                                                                                                                 | 
                                                            +				$retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7210
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7210
                                                                                                                                                                                                 | 
                                                             				//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7211
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7211
                                                                                                                                                                                                 | 
                                                             				$retstring .= '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7212
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7212
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7219,17 +7219,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7219
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7219
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7220
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7220
                                                                                                                                                                                                 | 
                                                             		if ($m) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7221
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7221
                                                                                                                                                                                                 | 
                                                             			// Show minutes  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7222
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7222
                                                                                                                                                                                                 | 
                                                            +			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7223
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7223
                                                                                                                                                                                                 | 
                                                             			if ($emptyhours) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7224
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7224
                                                                                                                                                                                                 | 
                                                             				$retstring .= '<option value="-1"> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7225
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7225
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7226
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7226
                                                                                                                                                                                                 | 
                                                             			for ($min = 0; $min < 60; $min += $stepminutes) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7227
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7227
                                                                                                                                                                                                 | 
                                                             				$min_str = sprintf("%02d", $min); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7228
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7228
                                                                                                                                                                                                 | 
                                                            +				$retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7229
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7229
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7230
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7230
                                                                                                                                                                                                 | 
                                                             			$retstring .= '</select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7231
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7231
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7232
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7232
                                                                                                                                                                                                 | 
                                                            +			$retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7233
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7233
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7234
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7234
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7235
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7235
                                                                                                                                                                                                 | 
                                                             		if ($d && $h) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7252,10 +7252,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7252
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7252
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7253
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7253
                                                                                                                                                                                                 | 
                                                             			// Generate the date part, depending on the use or not of the javascript calendar  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7254
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7254
                                                                                                                                                                                                 | 
                                                             			if ($addnowlink == 1) { // server time expressed in user time setup | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7255
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7256
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7257
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7258
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7255
                                                                                                                                                                                                 | 
                                                            +				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7256
                                                                                                                                                                                                 | 
                                                            +				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7257
                                                                                                                                                                                                 | 
                                                            +				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7258
                                                                                                                                                                                                 | 
                                                            +				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7259
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7259
                                                                                                                                                                                                 | 
                                                             			} elseif ($addnowlink == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7260
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7260
                                                                                                                                                                                                 | 
                                                             				/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7261
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7261
                                                                                                                                                                                                 | 
                                                             				 * This break application for foreign languages.  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7264,10 +7264,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7264
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7264
                                                                                                                                                                                                 | 
                                                             				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7265
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7265
                                                                                                                                                                                                 | 
                                                             				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7266
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7266
                                                                                                                                                                                                 | 
                                                             				*/  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7267
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7268
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7269
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7270
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7267
                                                                                                                                                                                                 | 
                                                            +				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7268
                                                                                                                                                                                                 | 
                                                            +				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7269
                                                                                                                                                                                                 | 
                                                            +				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7270
                                                                                                                                                                                                 | 
                                                            +				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7271
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7271
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7272
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7272
                                                                                                                                                                                                 | 
                                                             			/*if ($usecalendar == "eldy")  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7273
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7273
                                                                                                                                                                                                 | 
                                                             			{ | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7287,11 +7287,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7287
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7287
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7288
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7288
                                                                                                                                                                                                 | 
                                                             				//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7289
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7289
                                                                                                                                                                                                 | 
                                                             				if ($addnowlink == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7290
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7291
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7290
                                                                                                                                                                                                 | 
                                                            +					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7291
                                                                                                                                                                                                 | 
                                                            +					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7292
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7292
                                                                                                                                                                                                 | 
                                                             				} elseif ($addnowlink == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7293
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7294
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7293
                                                                                                                                                                                                 | 
                                                            +					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7294
                                                                                                                                                                                                 | 
                                                            +					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7295
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7295
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7296
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7296
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7297
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7297
                                                                                                                                                                                                 | 
                                                             				if ($fullday) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7305,11 +7305,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7305
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7305
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7306
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7306
                                                                                                                                                                                                 | 
                                                             				//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7307
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7307
                                                                                                                                                                                                 | 
                                                             				if ($addnowlink == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7308
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7309
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7308
                                                                                                                                                                                                 | 
                                                            +					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7309
                                                                                                                                                                                                 | 
                                                            +					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7310
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7310
                                                                                                                                                                                                 | 
                                                             				} elseif ($addnowlink == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7311
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7312
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7311
                                                                                                                                                                                                 | 
                                                            +					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7312
                                                                                                                                                                                                 | 
                                                            +					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7313
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7313
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7314
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7314
                                                                                                                                                                                                 | 
                                                             				if ($fullday) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7315
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7315
                                                                                                                                                                                                 | 
                                                             					$reset_scripts .= ' } ';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7317,7 +7317,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7317
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7317
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7318
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7318
                                                                                                                                                                                                 | 
                                                             			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7319
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7319
                                                                                                                                                                                                 | 
                                                             			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7320
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7320
                                                                                                                                                                                                 | 
                                                            +				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7321
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7321
                                                                                                                                                                                                 | 
                                                             				$retstring .= $langs->trans("Now"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7322
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7322
                                                                                                                                                                                                 | 
                                                             				$retstring .= '</button> ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7323
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7323
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7329,16 +7329,16 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7329
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7329
                                                                                                                                                                                                 | 
                                                             			$reset_scripts = "";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7330
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7330
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7331
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7331
                                                                                                                                                                                                 | 
                                                             			// Generate the date part, depending on the use or not of the javascript calendar  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7332
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7333
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7334
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7335
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7332
                                                                                                                                                                                                 | 
                                                            +			$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7333
                                                                                                                                                                                                 | 
                                                            +			$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7334
                                                                                                                                                                                                 | 
                                                            +			$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7335
                                                                                                                                                                                                 | 
                                                            +			$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7336
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7336
                                                                                                                                                                                                 | 
                                                             			// Update the hour part  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7337
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7337
                                                                                                                                                                                                 | 
                                                             			if ($h) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7338
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7338
                                                                                                                                                                                                 | 
                                                             				if ($fullday) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7339
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7339
                                                                                                                                                                                                 | 
                                                             					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7340
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7340
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7341
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7341
                                                                                                                                                                                                 | 
                                                            +				$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7342
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7342
                                                                                                                                                                                                 | 
                                                             				if ($fullday) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7343
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7343
                                                                                                                                                                                                 | 
                                                             					$reset_scripts .= ' } ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7344
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7344
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7348,14 +7348,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7348
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7348
                                                                                                                                                                                                 | 
                                                             				if ($fullday) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7349
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7349
                                                                                                                                                                                                 | 
                                                             					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7350
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7350
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7351
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7351
                                                                                                                                                                                                 | 
                                                            +				$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7352
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7352
                                                                                                                                                                                                 | 
                                                             				if ($fullday) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7353
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7353
                                                                                                                                                                                                 | 
                                                             					$reset_scripts .= ' } ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7354
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7354
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7355
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7355
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7356
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7356
                                                                                                                                                                                                 | 
                                                             			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7357
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7357
                                                                                                                                                                                                 | 
                                                             			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7358
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7358
                                                                                                                                                                                                 | 
                                                            +				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7359
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7359
                                                                                                                                                                                                 | 
                                                             				$retstring .= $langs->trans("DateStartPlusOne"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7360
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7360
                                                                                                                                                                                                 | 
                                                             				$retstring .= '</button> ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7361
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7361
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7413,17 +7413,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7413
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7413
                                                                                                                                                                                                 | 
                                                             			unset($TDurationTypes[$value]);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7414
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7414
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7415
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7415
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7416
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7416
                                                                                                                                                                                                 | 
                                                            +		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7417
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7417
                                                                                                                                                                                                 | 
                                                             		foreach ($TDurationTypes as $key => $typeduration) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7418
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= '<option value="' . $key . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7418
                                                                                                                                                                                                 | 
                                                            +			$retstring .= '<option value="'.$key.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7419
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7419
                                                                                                                                                                                                 | 
                                                             			if ($key == $selected) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7420
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7420
                                                                                                                                                                                                 | 
                                                             				$retstring .= " selected";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7421
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7421
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7422
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= ">" . $typeduration . "</option>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7422
                                                                                                                                                                                                 | 
                                                            +			$retstring .= ">".$typeduration."</option>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7423
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7423
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7424
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7424
                                                                                                                                                                                                 | 
                                                             		$retstring .= "</select>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7425
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7425
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7426
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7426
                                                                                                                                                                                                 | 
                                                            +		$retstring .= ajax_combobox('select_'.$prefix.'type_duration'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7427
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7427
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7428
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7428
                                                                                                                                                                                                 | 
                                                             		return $retstring;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7429
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7429
                                                                                                                                                                                                 | 
                                                             	}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7455,30 +7455,30 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7455
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7455
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7456
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7456
                                                                                                                                                                                                 | 
                                                             		// Hours  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7457
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7457
                                                                                                                                                                                                 | 
                                                             		if ($iSecond != '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7458
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7458
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7459
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7459
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7460
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7460
                                                                                                                                                                                                 | 
                                                             			$hourSelected = convertSecondToTime($iSecond, 'allhour');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7461
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7461
                                                                                                                                                                                                 | 
                                                             			$minSelected = convertSecondToTime($iSecond, 'min');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7462
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7462
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7463
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7463
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7464
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7464
                                                                                                                                                                                                 | 
                                                             		if ($typehour == 'select') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7465
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7465
                                                                                                                                                                                                 | 
                                                            +			$retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7466
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7466
                                                                                                                                                                                                 | 
                                                             			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7467
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$retstring .= '<option value="' . $hour . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7467
                                                                                                                                                                                                 | 
                                                            +				$retstring .= '<option value="'.$hour.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7468
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7468
                                                                                                                                                                                                 | 
                                                             				if (is_numeric($hourSelected) && $hourSelected == $hour) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7469
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7469
                                                                                                                                                                                                 | 
                                                             					$retstring .= " selected";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7470
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7470
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7471
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$retstring .= ">" . $hour . "</option>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7471
                                                                                                                                                                                                 | 
                                                            +				$retstring .= ">".$hour."</option>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7472
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7472
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7473
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7473
                                                                                                                                                                                                 | 
                                                             			$retstring .= "</select>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7474
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7474
                                                                                                                                                                                                 | 
                                                             		} elseif ($typehour == 'text' || $typehour == 'textselect') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7475
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7475
                                                                                                                                                                                                 | 
                                                            +			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7476
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7476
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7477
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7477
                                                                                                                                                                                                 | 
                                                             			return 'BadValueForParameterTypeHour';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7478
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7478
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7479
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7479
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7480
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7480
                                                                                                                                                                                                 | 
                                                             		if ($typehour != 'text') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7481
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= ' ' . $langs->trans('HourShort'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7481
                                                                                                                                                                                                 | 
                                                            +			$retstring .= ' '.$langs->trans('HourShort'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7482
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7482
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7483
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7483
                                                                                                                                                                                                 | 
                                                             			$retstring .= '<span class="">:</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7484
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7484
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7493,21 +7493,21 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7493
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7493
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7494
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7494
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7495
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7495
                                                                                                                                                                                                 | 
                                                             		if ($typehour == 'select' || $typehour == 'textselect') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7496
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7496
                                                                                                                                                                                                 | 
                                                            +			$retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7497
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7497
                                                                                                                                                                                                 | 
                                                             			for ($min = 0; $min <= 55; $min += 5) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7498
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$retstring .= '<option value="' . $min . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7498
                                                                                                                                                                                                 | 
                                                            +				$retstring .= '<option value="'.$min.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7499
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7499
                                                                                                                                                                                                 | 
                                                             				if (is_numeric($minSelected) && $minSelected == $min) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7500
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7500
                                                                                                                                                                                                 | 
                                                             					$retstring .= ' selected';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7501
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7501
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7502
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$retstring .= '>' . $min . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7502
                                                                                                                                                                                                 | 
                                                            +				$retstring .= '>'.$min.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7503
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7503
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7504
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7504
                                                                                                                                                                                                 | 
                                                             			$retstring .= "</select>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7505
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7505
                                                                                                                                                                                                 | 
                                                             		} elseif ($typehour == 'text') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7506
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7506
                                                                                                                                                                                                 | 
                                                            +			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7507
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7507
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7508
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7508
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7509
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7509
                                                                                                                                                                                                 | 
                                                             		if ($typehour != 'text') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7510
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= ' ' . $langs->trans('MinuteShort'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7510
                                                                                                                                                                                                 | 
                                                            +			$retstring .= ' '.$langs->trans('MinuteShort'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7511
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7511
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7512
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7512
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7513
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7513
                                                                                                                                                                                                 | 
                                                             		$retstring .= "</span>";  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7555,7 +7555,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7555
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7555
                                                                                                                                                                                                 | 
                                                             			$placeholder = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7556
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7556
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7557
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7557
                                                                                                                                                                                                 | 
                                                             			if ($selected && empty($selected_input_value)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7558
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7558
                                                                                                                                                                                                 | 
                                                            +				require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7559
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7559
                                                                                                                                                                                                 | 
                                                             				$tickettmpselect = new Ticket($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7560
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7560
                                                                                                                                                                                                 | 
                                                             				$tickettmpselect->fetch($selected);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7561
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7561
                                                                                                                                                                                                 | 
                                                             				$selected_input_value = $tickettmpselect->ref;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7563,17 +7563,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7563
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7563
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7564
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7564
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7565
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7565
                                                                                                                                                                                                 | 
                                                             			$urloption = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7566
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7566
                                                                                                                                                                                                 | 
                                                            +			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7567
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7567
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7568
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7568
                                                                                                                                                                                                 | 
                                                             			if (empty($hidelabel)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7569
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7569
                                                                                                                                                                                                 | 
                                                            +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7570
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7570
                                                                                                                                                                                                 | 
                                                             			} elseif ($hidelabel > 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7571
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7571
                                                                                                                                                                                                 | 
                                                            +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7572
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7572
                                                                                                                                                                                                 | 
                                                             				if ($hidelabel == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7573
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7573
                                                                                                                                                                                                 | 
                                                             					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7574
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7574
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7575
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7575
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7576
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7576
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7577
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7577
                                                                                                                                                                                                 | 
                                                             			if ($hidelabel == 3) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7578
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7578
                                                                                                                                                                                                 | 
                                                             				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7579
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7579
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7617,8 +7617,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7617
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7617
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7618
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7618
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7619
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7619
                                                                                                                                                                                                 | 
                                                             		$sql .= $selectFields;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7620
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "ticket as p";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7621
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7620
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."ticket as p";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7621
                                                                                                                                                                                                 | 
                                                            +		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7622
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7622
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7623
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7623
                                                                                                                                                                                                 | 
                                                             		// Add criteria on ref/label  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7624
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7624
                                                                                                                                                                                                 | 
                                                             		if ($filterkey != '') { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7634,7 +7634,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7634
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7634
                                                                                                                                                                                                 | 
                                                             				if ($i > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7635
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7635
                                                                                                                                                                                                 | 
                                                             					$sql .= " AND ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7636
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7636
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7637
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7637
                                                                                                                                                                                                 | 
                                                            +				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7638
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7638
                                                                                                                                                                                                 | 
                                                             				$sql .= ")";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7639
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7639
                                                                                                                                                                                                 | 
                                                             				$i++;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7640
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7640
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7647,22 +7647,22 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7647
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7647
                                                                                                                                                                                                 | 
                                                             		$sql .= $this->db->plimit($limit, 0);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7648
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7648
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7649
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7649
                                                                                                                                                                                                 | 
                                                             		// Build output string  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7650
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7650
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7651
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7651
                                                                                                                                                                                                 | 
                                                             		$result = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7652
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7652
                                                                                                                                                                                                 | 
                                                             		if ($result) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7653
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7654
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7653
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7654
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7655
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7655
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7656
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7656
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7657
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7657
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7658
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7658
                                                                                                                                                                                                 | 
                                                             			$events = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7659
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7659
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7660
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7660
                                                                                                                                                                                                 | 
                                                             			if (!$forcecombo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7661
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7661
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7662
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7662
                                                                                                                                                                                                 | 
                                                             				$out .= ajax_combobox($htmlname, $events, $conf->global->TICKET_USE_SEARCH_TO_SELECT);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7663
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7663
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7664
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7664
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7665
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7665
                                                                                                                                                                                                 | 
                                                            +			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7666
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7666
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7667
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7667
                                                                                                                                                                                                 | 
                                                             			$textifempty = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7668
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7668
                                                                                                                                                                                                 | 
                                                             			// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7679,7 +7679,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7679
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7679
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7680
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7680
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7681
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7681
                                                                                                                                                                                                 | 
                                                             			if ($showempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7682
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="0" selected>' . $textifempty . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7682
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="0" selected>'.$textifempty.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7683
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7683
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7684
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7684
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7685
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7685
                                                                                                                                                                                                 | 
                                                             			$i = 0;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7734,13 +7734,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7734
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7734
                                                                                                                                                                                                 | 
                                                             		$outref = $objp->ref;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7735
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7735
                                                                                                                                                                                                 | 
                                                             		$outtype = $objp->fk_product_type;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7736
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7736
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7737
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$opt = '<option value="' . $objp->rowid . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7737
                                                                                                                                                                                                 | 
                                                            +		$opt = '<option value="'.$objp->rowid.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7738
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7738
                                                                                                                                                                                                 | 
                                                             		$opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7739
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7739
                                                                                                                                                                                                 | 
                                                             		$opt .= '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7740
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7740
                                                                                                                                                                                                 | 
                                                             		$opt .= $objp->ref;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7741
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7741
                                                                                                                                                                                                 | 
                                                             		$objRef = $objp->ref;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7742
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7742
                                                                                                                                                                                                 | 
                                                             		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7743
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7743
                                                                                                                                                                                                 | 
                                                            +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7744
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7744
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7745
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7745
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7746
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7746
                                                                                                                                                                                                 | 
                                                             		$opt .= "</option>\n";  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7781,7 +7781,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7781
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7781
                                                                                                                                                                                                 | 
                                                             			$placeholder = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7782
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7782
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7783
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7783
                                                                                                                                                                                                 | 
                                                             			if ($selected && empty($selected_input_value)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7784
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7784
                                                                                                                                                                                                 | 
                                                            +				require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7785
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7785
                                                                                                                                                                                                 | 
                                                             				$projecttmpselect = new Project($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7786
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7786
                                                                                                                                                                                                 | 
                                                             				$projecttmpselect->fetch($selected);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7787
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7787
                                                                                                                                                                                                 | 
                                                             				$selected_input_value = $projecttmpselect->ref;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7789,17 +7789,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7789
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7789
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7790
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7790
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7791
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7791
                                                                                                                                                                                                 | 
                                                             			$urloption = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7792
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7792
                                                                                                                                                                                                 | 
                                                            +			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7793
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7793
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7794
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7794
                                                                                                                                                                                                 | 
                                                             			if (empty($hidelabel)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7795
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7795
                                                                                                                                                                                                 | 
                                                            +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7796
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7796
                                                                                                                                                                                                 | 
                                                             			} elseif ($hidelabel > 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7797
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7797
                                                                                                                                                                                                 | 
                                                            +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7798
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7798
                                                                                                                                                                                                 | 
                                                             				if ($hidelabel == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7799
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7799
                                                                                                                                                                                                 | 
                                                             					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7800
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7800
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7801
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7801
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7802
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7802
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7803
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7803
                                                                                                                                                                                                 | 
                                                             			if ($hidelabel == 3) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7804
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7804
                                                                                                                                                                                                 | 
                                                             				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7805
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7805
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7842,8 +7842,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7842
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7842
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7843
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7843
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7844
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7844
                                                                                                                                                                                                 | 
                                                             		$sql .= $selectFields;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7845
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "projet as p";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7846
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7845
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."projet as p";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7846
                                                                                                                                                                                                 | 
                                                            +		$sql .= ' WHERE p.entity IN ('.getEntity('project').')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7847
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7847
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7848
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7848
                                                                                                                                                                                                 | 
                                                             		// Add criteria on ref/label  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7849
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7849
                                                                                                                                                                                                 | 
                                                             		if ($filterkey != '') { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7859,7 +7859,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7859
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7859
                                                                                                                                                                                                 | 
                                                             				if ($i > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7860
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7860
                                                                                                                                                                                                 | 
                                                             					$sql .= " AND ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7861
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7861
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7862
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7862
                                                                                                                                                                                                 | 
                                                            +				$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7863
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7863
                                                                                                                                                                                                 | 
                                                             				$sql .= "";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7864
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7864
                                                                                                                                                                                                 | 
                                                             				$i++;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7865
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7865
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7872,22 +7872,22 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7872
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7872
                                                                                                                                                                                                 | 
                                                             		$sql .= $this->db->plimit($limit, 0);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7873
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7873
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7874
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7874
                                                                                                                                                                                                 | 
                                                             		// Build output string  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7875
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7875
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7876
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7876
                                                                                                                                                                                                 | 
                                                             		$result = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7877
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7877
                                                                                                                                                                                                 | 
                                                             		if ($result) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7878
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7879
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7878
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7879
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7880
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7880
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7881
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7881
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7882
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7882
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7883
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7883
                                                                                                                                                                                                 | 
                                                             			$events = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7884
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7884
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7885
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7885
                                                                                                                                                                                                 | 
                                                             			if (!$forcecombo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7886
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7886
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7887
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7887
                                                                                                                                                                                                 | 
                                                             				$out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7888
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7888
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7889
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7889
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7890
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7890
                                                                                                                                                                                                 | 
                                                            +			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7891
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7891
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7892
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7892
                                                                                                                                                                                                 | 
                                                             			$textifempty = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7893
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7893
                                                                                                                                                                                                 | 
                                                             			// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7904,7 +7904,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7904
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7904
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7905
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7905
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7906
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7906
                                                                                                                                                                                                 | 
                                                             			if ($showempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7907
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="0" selected>' . $textifempty . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7907
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="0" selected>'.$textifempty.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7908
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7908
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7909
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7909
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7910
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7910
                                                                                                                                                                                                 | 
                                                             			$i = 0;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -7962,13 +7962,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    7962
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7962
                                                                                                                                                                                                 | 
                                                             		$outlabel = $objp->label;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7963
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7963
                                                                                                                                                                                                 | 
                                                             		$outtype = $objp->fk_product_type;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7964
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7964
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7965
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$opt = '<option value="' . $objp->rowid . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7965
                                                                                                                                                                                                 | 
                                                            +		$opt = '<option value="'.$objp->rowid.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7966
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7966
                                                                                                                                                                                                 | 
                                                             		$opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7967
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7967
                                                                                                                                                                                                 | 
                                                             		$opt .= '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7968
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7968
                                                                                                                                                                                                 | 
                                                             		$opt .= $objp->ref;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7969
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7969
                                                                                                                                                                                                 | 
                                                             		$objRef = $objp->ref;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7970
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7970
                                                                                                                                                                                                 | 
                                                             		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7971
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    7971
                                                                                                                                                                                                 | 
                                                            +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7972
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7972
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7973
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7973
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    7974
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    7974
                                                                                                                                                                                                 | 
                                                             		$opt .= "</option>\n";  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8010,7 +8010,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8010
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8010
                                                                                                                                                                                                 | 
                                                             			$placeholder = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8011
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8011
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8012
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8012
                                                                                                                                                                                                 | 
                                                             			if ($selected && empty($selected_input_value)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8013
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8013
                                                                                                                                                                                                 | 
                                                            +				require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8014
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8014
                                                                                                                                                                                                 | 
                                                             				$adherenttmpselect = new Adherent($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8015
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8015
                                                                                                                                                                                                 | 
                                                             				$adherenttmpselect->fetch($selected);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8016
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8016
                                                                                                                                                                                                 | 
                                                             				$selected_input_value = $adherenttmpselect->ref;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8019,17 +8019,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8019
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8019
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8020
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8020
                                                                                                                                                                                                 | 
                                                             			$urloption = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8021
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8021
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8022
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8022
                                                                                                                                                                                                 | 
                                                            +			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8023
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8023
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8024
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8024
                                                                                                                                                                                                 | 
                                                             			if (empty($hidelabel)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8025
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8025
                                                                                                                                                                                                 | 
                                                            +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8026
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8026
                                                                                                                                                                                                 | 
                                                             			} elseif ($hidelabel > 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8027
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8027
                                                                                                                                                                                                 | 
                                                            +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8028
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8028
                                                                                                                                                                                                 | 
                                                             				if ($hidelabel == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8029
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8029
                                                                                                                                                                                                 | 
                                                             					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8030
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8030
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8031
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8031
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8032
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8032
                                                                                                                                                                                                 | 
                                                            +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8033
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8033
                                                                                                                                                                                                 | 
                                                             			if ($hidelabel == 3) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8034
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8034
                                                                                                                                                                                                 | 
                                                             				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8035
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8035
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8074,8 +8074,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8074
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8074
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8075
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8075
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8076
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8076
                                                                                                                                                                                                 | 
                                                             		$sql .= $selectFields;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8077
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "adherent as p";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8078
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8077
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."adherent as p";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8078
                                                                                                                                                                                                 | 
                                                            +		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8079
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8079
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8080
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8080
                                                                                                                                                                                                 | 
                                                             		// Add criteria on ref/label  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8081
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8081
                                                                                                                                                                                                 | 
                                                             		if ($filterkey != '') { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8091,8 +8091,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8091
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8091
                                                                                                                                                                                                 | 
                                                             				if ($i > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8092
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8092
                                                                                                                                                                                                 | 
                                                             					$sql .= " AND ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8093
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8093
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8094
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8095
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8094
                                                                                                                                                                                                 | 
                                                            +				$sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8095
                                                                                                                                                                                                 | 
                                                            +				$sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8096
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8096
                                                                                                                                                                                                 | 
                                                             				$i++;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8097
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8097
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8098
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8098
                                                                                                                                                                                                 | 
                                                             			if (count($search_crit) > 1) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8101,27 +8101,27 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8101
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8101
                                                                                                                                                                                                 | 
                                                             			$sql .= ')';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8102
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8102
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8103
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8103
                                                                                                                                                                                                 | 
                                                             		if ($status != -1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8104
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= ' AND statut = ' . ((int) $status);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8104
                                                                                                                                                                                                 | 
                                                            +			$sql .= ' AND statut = '.((int) $status);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8105
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8105
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8106
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8106
                                                                                                                                                                                                 | 
                                                             		$sql .= $this->db->plimit($limit, 0);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8107
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8107
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8108
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8108
                                                                                                                                                                                                 | 
                                                             		// Build output string  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8109
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8109
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8110
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8110
                                                                                                                                                                                                 | 
                                                             		$result = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8111
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8111
                                                                                                                                                                                                 | 
                                                             		if ($result) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8112
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8113
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8112
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8113
                                                                                                                                                                                                 | 
                                                            +			require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8114
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8114
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8115
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8115
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8116
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8116
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8117
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8117
                                                                                                                                                                                                 | 
                                                             			$events = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8118
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8118
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8119
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8119
                                                                                                                                                                                                 | 
                                                             			if (!$forcecombo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8120
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8120
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8121
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8121
                                                                                                                                                                                                 | 
                                                             				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8122
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8122
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8123
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8123
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8124
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8124
                                                                                                                                                                                                 | 
                                                            +			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8125
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8125
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8126
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8126
                                                                                                                                                                                                 | 
                                                             			$textifempty = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8127
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8127
                                                                                                                                                                                                 | 
                                                             			// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8138,7 +8138,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8138
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8138
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8139
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8139
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8140
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8140
                                                                                                                                                                                                 | 
                                                             			if ($showempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8141
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="-1" selected>' . $textifempty . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8141
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="-1" selected>'.$textifempty.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8142
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8142
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8143
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8143
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8144
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8144
                                                                                                                                                                                                 | 
                                                             			$i = 0;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8194,11 +8194,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8194
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8194
                                                                                                                                                                                                 | 
                                                             		$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8195
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8195
                                                                                                                                                                                                 | 
                                                             		$outtype = $objp->fk_adherent_type;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8196
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8196
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8197
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$opt = '<option value="' . $objp->rowid . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8197
                                                                                                                                                                                                 | 
                                                            +		$opt = '<option value="'.$objp->rowid.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8198
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8198
                                                                                                                                                                                                 | 
                                                             		$opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8199
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8199
                                                                                                                                                                                                 | 
                                                             		$opt .= '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8200
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8200
                                                                                                                                                                                                 | 
                                                             		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8201
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8201
                                                                                                                                                                                                 | 
                                                            +			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8202
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8202
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8203
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8203
                                                                                                                                                                                                 | 
                                                             		$opt .= $outlabel;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8204
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8204
                                                                                                                                                                                                 | 
                                                             		$opt .= "</option>\n";  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8236,8 +8236,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8236
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8236
                                                                                                                                                                                                 | 
                                                             		$objecttmp = null;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8237
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8237
                                                                                                                                                                                                 | 
                                                             		$InfoFieldList = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8238
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8238
                                                                                                                                                                                                 | 
                                                             		$classname = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8239
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$filter = '';  // Ensure filter has value (for static analysis)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8240
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sortfield = '';  // Ensure filter has value (for static analysis)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8239
                                                                                                                                                                                                 | 
                                                            +		$filter = ''; // Ensure filter has value (for static analysis)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8240
                                                                                                                                                                                                 | 
                                                            +		$sortfield = ''; // Ensure filter has value (for static analysis)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8241
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8241
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8242
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8242
                                                                                                                                                                                                 | 
                                                             		if ($objectfield) {	// We must retrieve the objectdesc from the field or extrafield | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8243
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8243
                                                                                                                                                                                                 | 
                                                             			// Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield'  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8281,9 +8281,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8281
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8281
                                                                                                                                                                                                 | 
                                                             			$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8282
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8282
                                                                                                                                                                                                 | 
                                                             			$reg = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8283
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8283
                                                                                                                                                                                                 | 
                                                             			if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8284
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$InfoFieldList[4] = $reg[1];    // take the sort field  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8284
                                                                                                                                                                                                 | 
                                                            +				$InfoFieldList[4] = $reg[1]; // take the sort field  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8285
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8285
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8286
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8286
                                                                                                                                                                                                 | 
                                                            +			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8287
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8287
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8288
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8288
                                                                                                                                                                                                 | 
                                                             			$classname = $InfoFieldList[0];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8289
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8289
                                                                                                                                                                                                 | 
                                                             			$classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1];  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8314,8 +8314,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8314
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8314
                                                                                                                                                                                                 | 
                                                             		);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8315
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8315
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8316
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8316
                                                                                                                                                                                                 | 
                                                             		if (!is_object($objecttmp)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8317
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8318
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8317
                                                                                                                                                                                                 | 
                                                            +			dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8318
                                                                                                                                                                                                 | 
                                                            +			return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8319
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8319
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8320
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8320
                                                                                                                                                                                                 | 
                                                             		'@phan-var-force CommonObject $objecttmp';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8321
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8321
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8327,9 +8327,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8327
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8327
                                                                                                                                                                                                 | 
                                                             		if ($prefixforautocompletemode == 'product') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8328
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8328
                                                                                                                                                                                                 | 
                                                             			$prefixforautocompletemode = 'produit';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8329
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8329
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8330
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8330
                                                                                                                                                                                                 | 
                                                            +		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8331
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8331
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8332
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8332
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8333
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8333
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8334
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8334
                                                                                                                                                                                                 | 
                                                             		// Generate the combo HTML component  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8335
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8335
                                                                                                                                                                                                 | 
                                                             		$out = '';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8358,13 +8358,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8358
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8358
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8359
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8359
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8360
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8360
                                                                                                                                                                                                 | 
                                                             			// Set url and param to call to get json of the search results  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8361
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8362
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8361
                                                                                                                                                                                                 | 
                                                            +			$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8362
                                                                                                                                                                                                 | 
                                                            +			$urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8363
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8363
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8364
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8364
                                                                                                                                                                                                 | 
                                                             			// Activate the auto complete using ajax call.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8365
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8365
                                                                                                                                                                                                 | 
                                                             			$out .= ajax_autocompleter($preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8366
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8366
                                                                                                                                                                                                 | 
                                                             			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8367
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$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) . '"' : '') . ' />';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8367
                                                                                                                                                                                                 | 
                                                            +			$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).'"' : '').' />';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8368
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8368
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8369
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8369
                                                                                                                                                                                                 | 
                                                             			// Immediate load of table record.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8370
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8370
                                                                                                                                                                                                 | 
                                                             			$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8404,16 +8404,16 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8404
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8404
                                                                                                                                                                                                 | 
                                                             		if ($prefixforautocompletemode == 'societe') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8405
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8405
                                                                                                                                                                                                 | 
                                                             			$prefixforautocompletemode = 'company';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8406
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8406
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8407
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8407
                                                                                                                                                                                                 | 
                                                            +		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8408
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8408
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8409
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8409
                                                                                                                                                                                                 | 
                                                             		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...) | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8410
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8410
                                                                                                                                                                                                 | 
                                                             			$tmpfieldstoshow = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8411
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8411
                                                                                                                                                                                                 | 
                                                             			foreach ($objecttmp->fields as $key => $val) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8412
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				if (! (int) dol_eval($val['enabled'], 1, 1, '1')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8412
                                                                                                                                                                                                 | 
                                                            +				if (!(int) dol_eval($val['enabled'], 1, 1, '1')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8413
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8413
                                                                                                                                                                                                 | 
                                                             					continue;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8414
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8414
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8415
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8415
                                                                                                                                                                                                 | 
                                                             				if (!empty($val['showoncombobox'])) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8416
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8416
                                                                                                                                                                                                 | 
                                                            +					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8417
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8417
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8418
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8418
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8419
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8419
                                                                                                                                                                                                 | 
                                                             			if ($tmpfieldstoshow) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8441,18 +8441,18 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8441
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8441
                                                                                                                                                                                                 | 
                                                             		$num = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8442
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8442
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8443
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8443
                                                                                                                                                                                                 | 
                                                             		// Search data  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8444
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8444
                                                                                                                                                                                                 | 
                                                            +		$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8445
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8445
                                                                                                                                                                                                 | 
                                                             		if (!empty($objecttmp->isextrafieldmanaged)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8446
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8446
                                                                                                                                                                                                 | 
                                                            +			$sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8447
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8447
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8448
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8448
                                                                                                                                                                                                 | 
                                                             		if (isset($objecttmp->ismultientitymanaged)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8449
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8449
                                                                                                                                                                                                 | 
                                                             			if (!is_numeric($objecttmp->ismultientitymanaged)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8450
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8450
                                                                                                                                                                                                 | 
                                                             				$tmparray = explode('@', $objecttmp->ismultientitymanaged); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8451
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8451
                                                                                                                                                                                                 | 
                                                            +				$sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8452
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8452
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8453
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8453
                                                                                                                                                                                                 | 
                                                             			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8454
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8454
                                                                                                                                                                                                 | 
                                                             				if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8455
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8455
                                                                                                                                                                                                 | 
                                                            +					$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8456
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8456
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8457
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8457
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8458
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8458
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8472,21 +8472,21 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8472
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8472
                                                                                                                                                                                                 | 
                                                             			$sql .= " WHERE 1=1";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8473
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8473
                                                                                                                                                                                                 | 
                                                             			if (isset($objecttmp->ismultientitymanaged)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8474
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8474
                                                                                                                                                                                                 | 
                                                             				if ($objecttmp->ismultientitymanaged == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8475
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8475
                                                                                                                                                                                                 | 
                                                            +					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8476
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8476
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8477
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8477
                                                                                                                                                                                                 | 
                                                             				if (!is_numeric($objecttmp->ismultientitymanaged)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8478
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$sql .= " AND parenttable.entity = t." . $tmparray[0];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8478
                                                                                                                                                                                                 | 
                                                            +					$sql .= " AND parenttable.entity = t.".$tmparray[0];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8479
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8479
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8480
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8480
                                                                                                                                                                                                 | 
                                                             				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8481
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8481
                                                                                                                                                                                                 | 
                                                             					if ($objecttmp->element == 'societe') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8482
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$sql .= " AND t.rowid = " . ((int) $user->socid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8482
                                                                                                                                                                                                 | 
                                                            +						$sql .= " AND t.rowid = ".((int) $user->socid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8483
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8483
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8484
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$sql .= " AND t.fk_soc = " . ((int) $user->socid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8484
                                                                                                                                                                                                 | 
                                                            +						$sql .= " AND t.fk_soc = ".((int) $user->socid);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8485
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8485
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8486
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8486
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8487
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8487
                                                                                                                                                                                                 | 
                                                             				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8488
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8488
                                                                                                                                                                                                 | 
                                                             					if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8489
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8489
                                                                                                                                                                                                 | 
                                                            +						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8490
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8490
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8491
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8491
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8492
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8492
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8498,7 +8498,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8498
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8498
                                                                                                                                                                                                 | 
                                                             				$errormessage = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8499
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8499
                                                                                                                                                                                                 | 
                                                             				$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8500
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8500
                                                                                                                                                                                                 | 
                                                             				if ($errormessage) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8501
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					return 'Error forging a SQL request from an universal criteria: ' . $errormessage;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8501
                                                                                                                                                                                                 | 
                                                            +					return 'Error forging a SQL request from an universal criteria: '.$errormessage;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8502
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8502
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8503
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8503
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8504
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8504
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8510,7 +8510,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8510
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8510
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8511
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8511
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8512
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8512
                                                                                                                                                                                                 | 
                                                             			// Construct $out and $outarray  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8513
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8513
                                                                                                                                                                                                 | 
                                                            +			$out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8514
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8514
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8515
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8515
                                                                                                                                                                                                 | 
                                                             			// Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8516
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8516
                                                                                                                                                                                                 | 
                                                             			$textifempty = ' ';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8524,7 +8524,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8524
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8524
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8525
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8525
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8526
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8526
                                                                                                                                                                                                 | 
                                                             			if ($showempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8527
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="-1">' . $textifempty . '</option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8527
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="-1">'.$textifempty.'</option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8528
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8528
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8529
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8529
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8530
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8530
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($resql);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8547,9 +8547,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8547
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8547
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8548
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8548
                                                                                                                                                                                                 | 
                                                             					if (empty($outputmode)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8549
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8549
                                                                                                                                                                                                 | 
                                                             						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8550
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$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>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8550
                                                                                                                                                                                                 | 
                                                            +							$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>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8551
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8551
                                                                                                                                                                                                 | 
                                                             						} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8552
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8552
                                                                                                                                                                                                 | 
                                                            +							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8553
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8553
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8554
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8554
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8555
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8555
                                                                                                                                                                                                 | 
                                                             						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8562,10 +8562,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8562
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8562
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8563
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8563
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8564
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8564
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8565
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '</select>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8565
                                                                                                                                                                                                 | 
                                                            +			$out .= '</select>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8566
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8566
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8567
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8567
                                                                                                                                                                                                 | 
                                                             			if (!$forcecombo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8568
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8568
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8569
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8569
                                                                                                                                                                                                 | 
                                                             				$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0));  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8570
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8570
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8571
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8571
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8629,8 +8629,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8629
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8629
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8630
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8630
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8631
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8631
                                                                                                                                                                                                 | 
                                                             		$idname = str_replace(array('[', ']'), array('', ''), $htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8632
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8633
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8632
                                                                                                                                                                                                 | 
                                                            +		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8633
                                                                                                                                                                                                 | 
                                                            +		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8634
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8634
                                                                                                                                                                                                 | 
                                                             		$out .= '>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8635
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8635
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8636
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8636
                                                                                                                                                                                                 | 
                                                             		if ($show_empty) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8641,7 +8641,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8641
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8641
                                                                                                                                                                                                 | 
                                                             			if (!is_numeric($show_empty)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8642
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8642
                                                                                                                                                                                                 | 
                                                             				$textforempty = $show_empty;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8643
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8643
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8644
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8644
                                                                                                                                                                                                 | 
                                                            +			$out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8645
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8645
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8646
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8646
                                                                                                                                                                                                 | 
                                                             		if (is_array($array)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8647
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8647
                                                                                                                                                                                                 | 
                                                             			// Translate  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8666,7 +8666,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8666
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8666
                                                                                                                                                                                                 | 
                                                             					$value = $tmpvalue['label'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8667
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8667
                                                                                                                                                                                                 | 
                                                             					//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8668
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8668
                                                                                                                                                                                                 | 
                                                             					$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8669
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8669
                                                                                                                                                                                                 | 
                                                            +					$style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8670
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8670
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8671
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8671
                                                                                                                                                                                                 | 
                                                             					$value = $tmpvalue;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8672
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8672
                                                                                                                                                                                                 | 
                                                             					//$valuehtml = $tmpvalue;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8682,9 +8682,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8682
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8682
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8683
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8683
                                                                                                                                                                                                 | 
                                                             				if ($key_in_label) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8684
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8684
                                                                                                                                                                                                 | 
                                                             					if (empty($nohtmlescape)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8685
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8685
                                                                                                                                                                                                 | 
                                                            +						$selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8686
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8686
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8687
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8687
                                                                                                                                                                                                 | 
                                                            +						$selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8688
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8688
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8689
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8689
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8690
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8690
                                                                                                                                                                                                 | 
                                                             					if (empty($nohtmlescape)) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8696,8 +8696,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8696
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8696
                                                                                                                                                                                                 | 
                                                             						$selectOptionValue = ' ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8697
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8697
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8698
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8698
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8699
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="' . $key . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8700
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= $style . $disabled;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8699
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="'.$key.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8700
                                                                                                                                                                                                 | 
                                                            +				$out .= $style.$disabled;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8701
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8701
                                                                                                                                                                                                 | 
                                                             				if (is_array($id)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8702
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8702
                                                                                                                                                                                                 | 
                                                             					if (in_array($key, $id) && !$disabled) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8703
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8703
                                                                                                                                                                                                 | 
                                                             						$out .= ' selected'; // To preselect a value  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8709,7 +8709,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8709
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8709
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8710
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8710
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8711
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8711
                                                                                                                                                                                                 | 
                                                             				if (!empty($nohtmlescape)) {	// deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content. | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8712
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8712
                                                                                                                                                                                                 | 
                                                            +					$out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8713
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8713
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8714
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8714
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8715
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8715
                                                                                                                                                                                                 | 
                                                             				if (is_array($tmpvalue)) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8729,7 +8729,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8729
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8729
                                                                                                                                                                                                 | 
                                                             		// Add code for jquery to use multiselect  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8730
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8730
                                                                                                                                                                                                 | 
                                                             		if ($addjscombo && $jsbeautify) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8731
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8731
                                                                                                                                                                                                 | 
                                                             			// Enhance with select2  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8732
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8732
                                                                                                                                                                                                 | 
                                                            +			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8733
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8733
                                                                                                                                                                                                 | 
                                                             			$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8734
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8734
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8735
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8735
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8757,28 +8757,28 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8757
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8757
                                                                                                                                                                                                 | 
                                                             	public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8758
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8758
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8759
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8759
                                                                                                                                                                                                 | 
                                                             		global $conf, $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8760
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		global $delayedhtmlcontent;    // Will be used later outside of this function  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8760
                                                                                                                                                                                                 | 
                                                            +		global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8761
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8761
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8762
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8762
                                                                                                                                                                                                 | 
                                                             		// TODO Use an internal dolibarr component instead of select2  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8763
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8763
                                                                                                                                                                                                 | 
                                                             		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8764
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8764
                                                                                                                                                                                                 | 
                                                             			return '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8765
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8765
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8766
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8766
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8767
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8767
                                                                                                                                                                                                 | 
                                                            +		$out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8768
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8768
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8769
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8769
                                                                                                                                                                                                 | 
                                                             		$outdelayed = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8770
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8770
                                                                                                                                                                                                 | 
                                                             		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8771
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8771
                                                                                                                                                                                                 | 
                                                             			$tmpplugin = 'select2';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8772
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8773
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		    	<script nonce="' . getNonce() . '">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8772
                                                                                                                                                                                                 | 
                                                            +			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8773
                                                                                                                                                                                                 | 
                                                            +		    	<script nonce="' . getNonce().'">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8774
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8774
                                                                                                                                                                                                 | 
                                                             		    	$(document).ready(function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8775
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8775
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8776
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8776
                                                                                                                                                                                                 | 
                                                            +	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8777
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8777
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8778
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -	                $(".' . $htmlname . '").select2({ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8778
                                                                                                                                                                                                 | 
                                                            +	                $(".' . $htmlname.'").select2({ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8779
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8779
                                                                                                                                                                                                 | 
                                                             				    	ajax: { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8780
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8780
                                                                                                                                                                                                 | 
                                                             					    	dir: "ltr",  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8781
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					    	url: "' . $url . '",  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8781
                                                                                                                                                                                                 | 
                                                            +					    	url: "' . $url.'",  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8782
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8782
                                                                                                                                                                                                 | 
                                                             					    	dataType: \'json\',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8783
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8783
                                                                                                                                                                                                 | 
                                                             					    	delay: 250,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8784
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8784
                                                                                                                                                                                                 | 
                                                             					    	data: function (params) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8805,9 +8805,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8805
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8805
                                                                                                                                                                                                 | 
                                                             				    	},  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8806
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8806
                                                                                                                                                                                                 | 
                                                             		 				language: select2arrayoflanguage,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8807
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8807
                                                                                                                                                                                                 | 
                                                             						containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8808
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					    placeholder: "' . dol_escape_js($placeholder) . '",  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8808
                                                                                                                                                                                                 | 
                                                            +					    placeholder: "' . dol_escape_js($placeholder).'",  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8809
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8809
                                                                                                                                                                                                 | 
                                                             				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8810
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				    	minimumInputLength: ' . ((int) $minimumInputLength) . ',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8810
                                                                                                                                                                                                 | 
                                                            +				    	minimumInputLength: ' . ((int) $minimumInputLength).',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8811
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8811
                                                                                                                                                                                                 | 
                                                             				        formatResult: function (result, container, query, escapeMarkup) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8812
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8812
                                                                                                                                                                                                 | 
                                                             	                        return escapeMarkup(result.text);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8813
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8813
                                                                                                                                                                                                 | 
                                                             	                    },  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8815,10 +8815,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8815
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8815
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8816
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8816
                                                                                                                                                                                                 | 
                                                             	                ' . ($callurlonselect ? '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8817
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8817
                                                                                                                                                                                                 | 
                                                             	                /* Code to execute a GET when we select a value */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8818
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -	                $(".' . $htmlname . '").change(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8819
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				    	var selected = $(".' . $htmlname . '").val(); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8818
                                                                                                                                                                                                 | 
                                                            +	                $(".' . $htmlname.'").change(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8819
                                                                                                                                                                                                 | 
                                                            +				    	var selected = $(".' . $htmlname.'").val(); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8820
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8820
                                                                                                                                                                                                 | 
                                                             	                	console.log("We select in selectArrayAjax the entry "+selected) | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8821
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				        $(".' . $htmlname . '").val("");  /* reset visible combo value */ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8821
                                                                                                                                                                                                 | 
                                                            +				        $(".' . $htmlname.'").val("");  /* reset visible combo value */ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8822
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8822
                                                                                                                                                                                                 | 
                                                             	    			    $.each( saveRemoteData, function( key, value ) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8823
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8823
                                                                                                                                                                                                 | 
                                                             	    				        if (key == selected)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8824
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8824
                                                                                                                                                                                                 | 
                                                             	    			            { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8826,7 +8826,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8826
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8826
                                                                                                                                                                                                 | 
                                                             	    			                 location.assign(value.url);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8827
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8827
                                                                                                                                                                                                 | 
                                                             	    			            }  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8828
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8828
                                                                                                                                                                                                 | 
                                                             	                    });  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8829
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -	    			});' : '') . '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8829
                                                                                                                                                                                                 | 
                                                            +	    			});' : '').'  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8830
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8830
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8831
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8831
                                                                                                                                                                                                 | 
                                                             	    	   });  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8832
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8832
                                                                                                                                                                                                 | 
                                                             		       </script>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8862,14 +8862,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8862
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8862
                                                                                                                                                                                                 | 
                                                             	public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8863
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8863
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8864
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8864
                                                                                                                                                                                                 | 
                                                             		global $conf, $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8865
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		global $delayedhtmlcontent;    // Will be used later outside of this function  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8865
                                                                                                                                                                                                 | 
                                                            +		global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8866
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8866
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8867
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8867
                                                                                                                                                                                                 | 
                                                             		// TODO Use an internal dolibarr component instead of select2  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8868
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8868
                                                                                                                                                                                                 | 
                                                             		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8869
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8869
                                                                                                                                                                                                 | 
                                                             			return '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8870
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8870
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8871
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8871
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8872
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8872
                                                                                                                                                                                                 | 
                                                            +		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8873
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8873
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8874
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8874
                                                                                                                                                                                                 | 
                                                             		$formattedarrayresult = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8875
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8875
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8884,20 +8884,20 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8884
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8884
                                                                                                                                                                                                 | 
                                                             		$outdelayed = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8885
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8885
                                                                                                                                                                                                 | 
                                                             		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8886
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8886
                                                                                                                                                                                                 | 
                                                             			$tmpplugin = 'select2';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8887
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8888
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				<script nonce="' . getNonce() . '">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8887
                                                                                                                                                                                                 | 
                                                            +			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8888
                                                                                                                                                                                                 | 
                                                            +				<script nonce="' . getNonce().'">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8889
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8889
                                                                                                                                                                                                 | 
                                                             				$(document).ready(function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8890
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					var data = ' . json_encode($formattedarrayresult) . ';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8890
                                                                                                                                                                                                 | 
                                                            +					var data = ' . json_encode($formattedarrayresult).';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8891
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8891
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8892
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8892
                                                                                                                                                                                                 | 
                                                            +					' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8893
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8893
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8894
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$(".' . $htmlname . '").select2({ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8894
                                                                                                                                                                                                 | 
                                                            +					$(".' . $htmlname.'").select2({ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8895
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8895
                                                                                                                                                                                                 | 
                                                             						data: data,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8896
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8896
                                                                                                                                                                                                 | 
                                                             						language: select2arrayoflanguage,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8897
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8897
                                                                                                                                                                                                 | 
                                                             						containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8898
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						placeholder: "' . dol_escape_js($placeholder) . '",  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8898
                                                                                                                                                                                                 | 
                                                            +						placeholder: "' . dol_escape_js($placeholder).'",  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8899
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8899
                                                                                                                                                                                                 | 
                                                             						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8900
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						minimumInputLength: ' . $minimumInputLength . ',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8900
                                                                                                                                                                                                 | 
                                                            +						minimumInputLength: ' . $minimumInputLength.',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8901
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8901
                                                                                                                                                                                                 | 
                                                             						formatResult: function (result, container, query, escapeMarkup) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8902
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8902
                                                                                                                                                                                                 | 
                                                             							return escapeMarkup(result.text);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8903
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8903
                                                                                                                                                                                                 | 
                                                             						},  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8936,11 +8936,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8936
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8936
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8937
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8937
                                                                                                                                                                                                 | 
                                                             					' . ($callurlonselect ? '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8938
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8938
                                                                                                                                                                                                 | 
                                                             					/* Code to execute a GET when we select a value */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8939
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$(".' . $htmlname . '").change(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8940
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						var selected = $(".' . $htmlname . '").val(); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8939
                                                                                                                                                                                                 | 
                                                            +					$(".' . $htmlname.'").change(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8940
                                                                                                                                                                                                 | 
                                                            +						var selected = $(".' . $htmlname.'").val(); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8941
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8941
                                                                                                                                                                                                 | 
                                                             						console.log("We select "+selected) | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8942
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8942
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8943
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$(".' . $htmlname . '").val("");  /* reset visible combo value */ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8943
                                                                                                                                                                                                 | 
                                                            +						$(".' . $htmlname.'").val("");  /* reset visible combo value */ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8944
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8944
                                                                                                                                                                                                 | 
                                                             						$.each( saveRemoteData, function( key, value ) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8945
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8945
                                                                                                                                                                                                 | 
                                                             							if (key == selected)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8946
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8946
                                                                                                                                                                                                 | 
                                                             							{ | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8948,7 +8948,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8948
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8948
                                                                                                                                                                                                 | 
                                                             								location.assign(value.url);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8949
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8949
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8950
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8950
                                                                                                                                                                                                 | 
                                                             						});  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8951
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					});' : '') . '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    8951
                                                                                                                                                                                                 | 
                                                            +					});' : '').'  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8952
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8952
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8953
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8953
                                                                                                                                                                                                 | 
                                                             				});  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8954
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8954
                                                                                                                                                                                                 | 
                                                             				</script>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -8997,7 +8997,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    8997
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8997
                                                                                                                                                                                                 | 
                                                             		$useenhancedmultiselect = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8998
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8998
                                                                                                                                                                                                 | 
                                                             		if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    8999
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    8999
                                                                                                                                                                                                 | 
                                                             			if ($addjscombo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9000
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$useenhancedmultiselect = 1;	// Use the js multiselect in one line. Possible only if $addjscombo not 0.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9000
                                                                                                                                                                                                 | 
                                                            +				$useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9001
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9001
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9002
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9002
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9003
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9003
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9006,7 +9006,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9006
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9006
                                                                                                                                                                                                 | 
                                                             		// submitted to nothing.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9007
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9007
                                                                                                                                                                                                 | 
                                                             		$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9008
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9008
                                                                                                                                                                                                 | 
                                                             		// Output select component  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9009
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$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"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9009
                                                                                                                                                                                                 | 
                                                            +		$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"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9010
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9010
                                                                                                                                                                                                 | 
                                                             		if (is_array($array) && !empty($array)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9011
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9011
                                                                                                                                                                                                 | 
                                                             			if ($value_as_key) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9012
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9012
                                                                                                                                                                                                 | 
                                                             				$array = array_combine($array, $array);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9024,36 +9024,36 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9024
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9024
                                                                                                                                                                                                 | 
                                                             						$tmpvalue = empty($value['label']) ? '' : $value['label'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9025
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9025
                                                                                                                                                                                                 | 
                                                             						$tmpcolor = empty($value['color']) ? '' : $value['color'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9026
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9026
                                                                                                                                                                                                 | 
                                                             						$tmppicto = empty($value['picto']) ? '' : $value['picto'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9027
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']): $value['labelhtml'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9027
                                                                                                                                                                                                 | 
                                                            +						$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9028
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9028
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9029
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9029
                                                                                                                                                                                                 | 
                                                             					$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9030
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9030
                                                                                                                                                                                                 | 
                                                            +					$newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9031
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9031
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9032
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<option value="' . $tmpkey . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9032
                                                                                                                                                                                                 | 
                                                            +					$out .= '<option value="'.$tmpkey.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9033
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9033
                                                                                                                                                                                                 | 
                                                             					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9034
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9034
                                                                                                                                                                                                 | 
                                                             						$out .= ' selected';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9035
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9035
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9036
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9036
                                                                                                                                                                                                 | 
                                                             					if (!empty($tmplabelhtml)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9037
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9037
                                                                                                                                                                                                 | 
                                                            +						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9038
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9038
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9039
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9040
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9039
                                                                                                                                                                                                 | 
                                                            +						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9040
                                                                                                                                                                                                 | 
                                                            +						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9041
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9041
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9042
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9042
                                                                                                                                                                                                 | 
                                                             					$out .= '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9043
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9043
                                                                                                                                                                                                 | 
                                                             					$out .= dol_htmlentitiesbr($newval);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9044
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '</option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9044
                                                                                                                                                                                                 | 
                                                            +					$out .= '</option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9045
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9045
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9046
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9046
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9047
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9047
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9048
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out .= '</select>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9048
                                                                                                                                                                                                 | 
                                                            +		$out .= '</select>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9049
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9049
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9050
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9050
                                                                                                                                                                                                 | 
                                                             		// Add code for jquery to use multiselect  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9051
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9051
                                                                                                                                                                                                 | 
                                                             		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9052
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9053
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9052
                                                                                                                                                                                                 | 
                                                            +			$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9053
                                                                                                                                                                                                 | 
                                                            +			$out .= "\n".'<script nonce="'.getNonce().'">'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9054
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9054
                                                                                                                                                                                                 | 
                                                             			if ($addjscombo == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9055
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9055
                                                                                                                                                                                                 | 
                                                             				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9056
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= 'function formatResult(record, container) {' . "\n"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9056
                                                                                                                                                                                                 | 
                                                            +				$out .= 'function formatResult(record, container) {'."\n"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9057
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9057
                                                                                                                                                                                                 | 
                                                             				// If property data-html set, we decode html entities and use this.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9058
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9058
                                                                                                                                                                                                 | 
                                                             				// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9059
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9059
                                                                                                                                                                                                 | 
                                                             				$out .= '	if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {'; | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9061,26 +9061,26 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9061
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9061
                                                                                                                                                                                                 | 
                                                             				$out .= '		return htmlEntityDecodeJs($(record.element).attr("data-html"));'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9062
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9062
                                                                                                                                                                                                 | 
                                                             				$out .= '	}'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9063
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9063
                                                                                                                                                                                                 | 
                                                             				$out .= '	return record.text;';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9064
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '}' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9065
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= 'function formatSelection(record) {' . "\n"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9064
                                                                                                                                                                                                 | 
                                                            +				$out .= '}'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9065
                                                                                                                                                                                                 | 
                                                            +				$out .= 'function formatSelection(record) {'."\n"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9066
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9066
                                                                                                                                                                                                 | 
                                                             				if ($elemtype == 'category') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9067
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9067
                                                                                                                                                                                                 | 
                                                            +					$out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9068
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9068
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9069
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9069
                                                                                                                                                                                                 | 
                                                             					$out .= 'return record.text;';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9070
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9070
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9071
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '}' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9071
                                                                                                                                                                                                 | 
                                                            +				$out .= '}'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9072
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9072
                                                                                                                                                                                                 | 
                                                             				$out .= '$(document).ready(function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9073
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$(\'#' . $htmlname . '\').' . $tmpplugin . '({'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9073
                                                                                                                                                                                                 | 
                                                            +							$(\'#' . $htmlname.'\').'.$tmpplugin.'({'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9074
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9074
                                                                                                                                                                                                 | 
                                                             				if ($placeholder) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9075
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9075
                                                                                                                                                                                                 | 
                                                             					$out .= '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9076
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9076
                                                                                                                                                                                                 | 
                                                             								placeholder: { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9077
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9077
                                                                                                                                                                                                 | 
                                                             								    id: \'-1\',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9078
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								    text: \'' . dol_escape_js($placeholder) . '\'  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9078
                                                                                                                                                                                                 | 
                                                            +								    text: \'' . dol_escape_js($placeholder).'\'  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9079
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9079
                                                                                                                                                                                                 | 
                                                             								  },';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9080
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9080
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9081
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9081
                                                                                                                                                                                                 | 
                                                             				$out .= '		dir: \'ltr\',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9082
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9082
                                                                                                                                                                                                 | 
                                                             								containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9083
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								dropdownCssClass: \'' . $morecss . '\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9083
                                                                                                                                                                                                 | 
                                                            +								dropdownCssClass: \'' . $morecss.'\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9084
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9084
                                                                                                                                                                                                 | 
                                                             								// Specify format function for dropdown item  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9085
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9085
                                                                                                                                                                                                 | 
                                                             								formatResult: formatResult,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9086
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9086
                                                                                                                                                                                                 | 
                                                             							 	templateResult: formatResult,		/* For 4.0 */  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9092,21 +9092,21 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9092
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9092
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9093
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9093
                                                                                                                                                                                                 | 
                                                             							/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9094
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9094
                                                                                                                                                                                                 | 
                                                             								 the size only if component is not hidden by default on load */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9095
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9095
                                                                                                                                                                                                 | 
                                                            +							$(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9096
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9096
                                                                                                                                                                                                 | 
                                                             						});' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9097
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9097
                                                                                                                                                                                                 | 
                                                             			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9098
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9098
                                                                                                                                                                                                 | 
                                                             				// Add other js lib  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9099
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9099
                                                                                                                                                                                                 | 
                                                             				// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9100
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9100
                                                                                                                                                                                                 | 
                                                             				// ...  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9101
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9101
                                                                                                                                                                                                 | 
                                                            +				$out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9102
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9102
                                                                                                                                                                                                 | 
                                                             				$out .= '$(document).ready(function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9103
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$(\'#' . $htmlname . '\').multiSelect({ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9103
                                                                                                                                                                                                 | 
                                                            +							$(\'#' . $htmlname.'\').multiSelect({ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9104
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9104
                                                                                                                                                                                                 | 
                                                             								containerHTML: \'<div class="multi-select-container">\',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9105
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9105
                                                                                                                                                                                                 | 
                                                             								menuHTML: \'<div class="multi-select-menu">\',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9106
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9106
                                                                                                                                                                                                 | 
                                                            +								buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9107
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9107
                                                                                                                                                                                                 | 
                                                             								menuItemHTML: \'<label class="multi-select-menuitem">\',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9108
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9108
                                                                                                                                                                                                 | 
                                                             								activeClass: \'multi-select-container--open\',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9109
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								noneText: \'' . $placeholder . '\'  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9109
                                                                                                                                                                                                 | 
                                                            +								noneText: \'' . $placeholder.'\'  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9110
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9110
                                                                                                                                                                                                 | 
                                                             							});  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9111
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9111
                                                                                                                                                                                                 | 
                                                             						})';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9112
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9112
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9139,7 +9139,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9139
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9139
                                                                                                                                                                                                 | 
                                                             			return '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9140
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9140
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9141
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9141
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9142
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9142
                                                                                                                                                                                                 | 
                                                            +		$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9143
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9143
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9144
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9144
                                                                                                                                                                                                 | 
                                                             		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9145
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9145
                                                                                                                                                                                                 | 
                                                             			$tmparray = explode(',', $user->conf->$tmpvar); | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9182,19 +9182,19 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9182
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9182
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9183
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9183
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9184
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9184
                                                                                                                                                                                                 | 
                                                             				// Note: $val['checked'] <> 0 means we must show the field into the combo list  @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9185
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9186
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9185
                                                                                                                                                                                                 | 
                                                            +				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9186
                                                                                                                                                                                                 | 
                                                            +				$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9187
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9187
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9188
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9188
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9189
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9189
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9190
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9190
                                                                                                                                                                                                 | 
                                                            +		$out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9191
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9191
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9192
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9192
                                                                                                                                                                                                 | 
                                                                     <dl class="dropdown">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9193
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9193
                                                                                                                                                                                                 | 
                                                                         <dt>  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9194
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -            <a href="#' . $htmlname . '">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9195
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -              ' . img_picto('', 'list') . ' | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9194
                                                                                                                                                                                                 | 
                                                            +            <a href="#' . $htmlname.'">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9195
                                                                                                                                                                                                 | 
                                                            +              ' . img_picto('', 'list').' | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9196
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9196
                                                                                                                                                                                                 | 
                                                                         </a>  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9197
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -            <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9197
                                                                                                                                                                                                 | 
                                                            +            <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9198
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9198
                                                                                                                                                                                                 | 
                                                                         </dt>  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9199
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9199
                                                                                                                                                                                                 | 
                                                                         <dd class="dropdowndd">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9200
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9200
                                                                                                                                                                                                 | 
                                                                             <div class="multiselectcheckbox'.$htmlname.'">  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9206,19 +9206,19 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9206
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9206
                                                                                                                                                                                                 | 
                                                                         </dd>  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9207
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9207
                                                                                                                                                                                                 | 
                                                                     </dl>  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9208
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9208
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9209
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -        <script nonce="' . getNonce() . '" type="text/javascript">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9209
                                                                                                                                                                                                 | 
                                                            +        <script nonce="' . getNonce().'" type="text/javascript">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9210
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9210
                                                                                                                                                                                                 | 
                                                                       jQuery(document).ready(function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9211
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9211
                                                                                                                                                                                                 | 
                                                            +              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9212
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9212
                                                                                                                                                                                                 | 
                                                                               console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9213
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9213
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9214
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9214
                                                                                                                                                                                                 | 
                                                                               $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9215
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9215
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9216
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9216
                                                                                                                                                                                                 | 
                                                                               var title = $(this).val() + ",";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9217
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9217
                                                                                                                                                                                                 | 
                                                                               if ($(this).is(\':checked\')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9218
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                      $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9218
                                                                                                                                                                                                 | 
                                                            +                      $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9219
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9219
                                                                                                                                                                                                 | 
                                                                               }  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9220
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9220
                                                                                                                                                                                                 | 
                                                                               else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9221
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                      $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9221
                                                                                                                                                                                                 | 
                                                            +                      $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9222
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9222
                                                                                                                                                                                                 | 
                                                                               }  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9223
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9223
                                                                                                                                                                                                 | 
                                                                               // Now, we submit page  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9224
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9224
                                                                                                                                                                                                 | 
                                                                               //$(this).parents(\'form:first\').submit();  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9249,7 +9249,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9249
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9249
                                                                                                                                                                                                 | 
                                                             	 */  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9250
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9250
                                                                                                                                                                                                 | 
                                                             	public function showCategories($id, $type, $rendermode = 0, $nolink = 0)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9251
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9251
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9252
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9252
                                                                                                                                                                                                 | 
                                                            +		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9253
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9253
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9254
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9254
                                                                                                                                                                                                 | 
                                                             		$cat = new Categorie($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9255
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9255
                                                                                                                                                                                                 | 
                                                             		$categories = $cat->containing($id, $type);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9259,10 +9259,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9259
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9259
                                                                                                                                                                                                 | 
                                                             			foreach ($categories as $c) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9260
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9260
                                                                                                                                                                                                 | 
                                                             				$ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9261
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9261
                                                                                                                                                                                                 | 
                                                             				foreach ($ways as $way) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9262
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9262
                                                                                                                                                                                                 | 
                                                            +					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9263
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9263
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9264
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9264
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9265
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9265
                                                                                                                                                                                                 | 
                                                            +			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9266
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9266
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9267
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9267
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9268
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9268
                                                                                                                                                                                                 | 
                                                             		if ($rendermode == 0) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9310,15 +9310,15 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9310
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9310
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9311
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9311
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9312
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9312
                                                                                                                                                                                                 | 
                                                             			print '<div class="div-table-responsive-no-min">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9313
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '"  data-elementid="' . $object->id . '"   >';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9313
                                                                                                                                                                                                 | 
                                                            +			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'"  data-elementid="'.$object->id.'"   >';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9314
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9314
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9315
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9315
                                                                                                                                                                                                 | 
                                                             			print '<tr class="liste_titre">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9316
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<td>' . $langs->trans("Type") . '</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9317
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<td>' . $langs->trans("Ref") . '</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9316
                                                                                                                                                                                                 | 
                                                            +			print '<td>'.$langs->trans("Type").'</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9317
                                                                                                                                                                                                 | 
                                                            +			print '<td>'.$langs->trans("Ref").'</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9318
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9318
                                                                                                                                                                                                 | 
                                                             			print '<td class="center"></td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9319
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<td class="center">' . $langs->trans("Date") . '</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9320
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9321
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<td class="right">' . $langs->trans("Status") . '</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9319
                                                                                                                                                                                                 | 
                                                            +			print '<td class="center">'.$langs->trans("Date").'</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9320
                                                                                                                                                                                                 | 
                                                            +			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9321
                                                                                                                                                                                                 | 
                                                            +			print '<td class="right">'.$langs->trans("Status").'</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9322
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9322
                                                                                                                                                                                                 | 
                                                             			print '<td></td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9323
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9323
                                                                                                                                                                                                 | 
                                                             			print '</tr>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9324
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9324
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9337,13 +9337,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9337
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9337
                                                                                                                                                                                                 | 
                                                             				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9338
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9338
                                                                                                                                                                                                 | 
                                                             					$element = $regs[1];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9339
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9339
                                                                                                                                                                                                 | 
                                                             					$subelement = $regs[2];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9340
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$tplpath = $element . '/' . $subelement;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9340
                                                                                                                                                                                                 | 
                                                            +					$tplpath = $element.'/'.$subelement;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9341
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9341
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9342
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9342
                                                                                                                                                                                                 | 
                                                             				$tplname = 'linkedobjectblock';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9343
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9343
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9344
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9344
                                                                                                                                                                                                 | 
                                                             				// To work with non standard path  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9345
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9345
                                                                                                                                                                                                 | 
                                                             				if ($objecttype == 'facture') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9346
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$tplpath = 'compta/' . $element;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9346
                                                                                                                                                                                                 | 
                                                            +					$tplpath = 'compta/'.$element;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9347
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9347
                                                                                                                                                                                                 | 
                                                             					if (!isModEnabled('invoice')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9348
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9348
                                                                                                                                                                                                 | 
                                                             						continue; // Do not show if module disabled  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9349
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9349
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9354,7 +9354,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9354
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9354
                                                                                                                                                                                                 | 
                                                             						continue; // Do not show if module disabled  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9355
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9355
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9356
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9356
                                                                                                                                                                                                 | 
                                                             				} elseif ($objecttype == 'propal') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9357
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$tplpath = 'comm/' . $element;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9357
                                                                                                                                                                                                 | 
                                                            +					$tplpath = 'comm/'.$element;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9358
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9358
                                                                                                                                                                                                 | 
                                                             					if (!isModEnabled('propal')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9359
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9359
                                                                                                                                                                                                 | 
                                                             						continue; // Do not show if module disabled  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9360
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9360
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9405,7 +9405,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9405
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9405
                                                                                                                                                                                                 | 
                                                             				$linkedObjectBlock = $objects;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9406
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9406
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9407
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9407
                                                                                                                                                                                                 | 
                                                             				// Output template part (modules that overwrite templates must declare this into descriptor)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9408
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9408
                                                                                                                                                                                                 | 
                                                            +				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9409
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9409
                                                                                                                                                                                                 | 
                                                             				foreach ($dirtpls as $reldir) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9410
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9410
                                                                                                                                                                                                 | 
                                                             					$reldir = rtrim($reldir, '/');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9411
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9411
                                                                                                                                                                                                 | 
                                                             					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9413,7 +9413,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9413
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9413
                                                                                                                                                                                                 | 
                                                             						$noMoreLinkedObjectBlockAfter = 1;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9414
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9414
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9415
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9415
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9416
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9416
                                                                                                                                                                                                 | 
                                                            +					$res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9417
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9417
                                                                                                                                                                                                 | 
                                                             					if ($res) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9418
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9418
                                                                                                                                                                                                 | 
                                                             						$nboftypesoutput++;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9419
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9419
                                                                                                                                                                                                 | 
                                                             						break;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9422,7 +9422,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9422
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9422
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9423
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9423
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9424
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9424
                                                                                                                                                                                                 | 
                                                             			if (!$nboftypesoutput) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9425
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9425
                                                                                                                                                                                                 | 
                                                            +				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9426
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9426
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9427
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9427
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9428
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9428
                                                                                                                                                                                                 | 
                                                             			print '</table>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9462,14 +9462,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9462
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9462
                                                                                                                                                                                                 | 
                                                             		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9463
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9463
                                                                                                                                                                                                 | 
                                                             			$listofidcompanytoscan = $object->thirdparty->id;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9464
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9464
                                                                                                                                                                                                 | 
                                                             			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9465
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$listofidcompanytoscan .= ',' . $object->thirdparty->parent;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9465
                                                                                                                                                                                                 | 
                                                            +				$listofidcompanytoscan .= ','.$object->thirdparty->parent;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9466
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9466
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9467
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9467
                                                                                                                                                                                                 | 
                                                             			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9468
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9468
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9469
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9469
                                                                                                                                                                                                 | 
                                                             				$tmpproject = new Project($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9470
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9470
                                                                                                                                                                                                 | 
                                                             				$tmpproject->fetch($object->fk_project);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9471
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9471
                                                                                                                                                                                                 | 
                                                             				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9472
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$listofidcompanytoscan .= ',' . $tmpproject->socid;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9472
                                                                                                                                                                                                 | 
                                                            +					$listofidcompanytoscan .= ','.$tmpproject->socid;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9473
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9473
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9474
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9474
                                                                                                                                                                                                 | 
                                                             				unset($tmpproject);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9475
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9475
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9479,63 +9479,63 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9479
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9479
                                                                                                                                                                                                 | 
                                                             					'enabled' => isModEnabled('propal'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9480
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9480
                                                                                                                                                                                                 | 
                                                             					'perms' => 1,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9481
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9481
                                                                                                                                                                                                 | 
                                                             					'label' => 'LinkToProposal',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9482
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'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') . ')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9482
                                                                                                                                                                                                 | 
                                                            +					'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').')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9483
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9483
                                                                                                                                                                                                 | 
                                                             				'shipping' => array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9484
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9484
                                                                                                                                                                                                 | 
                                                             					'enabled' => isModEnabled('shipping'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9485
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9485
                                                                                                                                                                                                 | 
                                                             					'perms' => 1,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9486
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9486
                                                                                                                                                                                                 | 
                                                             					'label' => 'LinkToExpedition',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9487
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'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') . ')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9487
                                                                                                                                                                                                 | 
                                                            +					'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').')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9488
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9488
                                                                                                                                                                                                 | 
                                                             				'order' => array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9489
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9489
                                                                                                                                                                                                 | 
                                                             					'enabled' => isModEnabled('order'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9490
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9490
                                                                                                                                                                                                 | 
                                                             					'perms' => 1,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9491
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9491
                                                                                                                                                                                                 | 
                                                             					'label' => 'LinkToOrder',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9492
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'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') . ')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9492
                                                                                                                                                                                                 | 
                                                            +					'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').')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9493
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9493
                                                                                                                                                                                                 | 
                                                             				'invoice' => array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9494
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9494
                                                                                                                                                                                                 | 
                                                             					'enabled' => isModEnabled('invoice'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9495
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9495
                                                                                                                                                                                                 | 
                                                             					'perms' => 1,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9496
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9496
                                                                                                                                                                                                 | 
                                                             					'label' => 'LinkToInvoice',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9497
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'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') . ')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9497
                                                                                                                                                                                                 | 
                                                            +					'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').')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9498
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9498
                                                                                                                                                                                                 | 
                                                             				'invoice_template' => array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9499
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9499
                                                                                                                                                                                                 | 
                                                             					'enabled' => isModEnabled('invoice'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9500
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9500
                                                                                                                                                                                                 | 
                                                             					'perms' => 1,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9501
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9501
                                                                                                                                                                                                 | 
                                                             					'label' => 'LinkToTemplateInvoice',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9502
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'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') . ')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9502
                                                                                                                                                                                                 | 
                                                            +					'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').')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9503
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9503
                                                                                                                                                                                                 | 
                                                             				'contrat' => array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9504
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9504
                                                                                                                                                                                                 | 
                                                             					'enabled' => isModEnabled('contract'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9505
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9505
                                                                                                                                                                                                 | 
                                                             					'perms' => 1,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9506
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9506
                                                                                                                                                                                                 | 
                                                             					'label' => 'LinkToContract',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9507
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9507
                                                                                                                                                                                                 | 
                                                             					'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  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9508
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							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' | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9508
                                                                                                                                                                                                 | 
                                                            +							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' | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9509
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9509
                                                                                                                                                                                                 | 
                                                             				),  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9510
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9510
                                                                                                                                                                                                 | 
                                                             				'fichinter' => array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9511
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9511
                                                                                                                                                                                                 | 
                                                             					'enabled' => isModEnabled('intervention'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9512
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9512
                                                                                                                                                                                                 | 
                                                             					'perms' => 1,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9513
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9513
                                                                                                                                                                                                 | 
                                                             					'label' => 'LinkToIntervention',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9514
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'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') . ')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9514
                                                                                                                                                                                                 | 
                                                            +					'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').')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9515
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9515
                                                                                                                                                                                                 | 
                                                             				'supplier_proposal' => array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9516
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9516
                                                                                                                                                                                                 | 
                                                             					'enabled' => isModEnabled('supplier_proposal'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9517
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9517
                                                                                                                                                                                                 | 
                                                             					'perms' => 1,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9518
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9518
                                                                                                                                                                                                 | 
                                                             					'label' => 'LinkToSupplierProposal',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9519
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'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') . ')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9519
                                                                                                                                                                                                 | 
                                                            +					'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').')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9520
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9520
                                                                                                                                                                                                 | 
                                                             				'order_supplier' => array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9521
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9521
                                                                                                                                                                                                 | 
                                                             					'enabled' => isModEnabled("supplier_order"), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9522
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9522
                                                                                                                                                                                                 | 
                                                             					'perms' => 1,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9523
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9523
                                                                                                                                                                                                 | 
                                                             					'label' => 'LinkToSupplierOrder',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9524
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'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') . ')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9524
                                                                                                                                                                                                 | 
                                                            +					'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').')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9525
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9525
                                                                                                                                                                                                 | 
                                                             				'invoice_supplier' => array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9526
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9526
                                                                                                                                                                                                 | 
                                                             					'enabled' => isModEnabled("supplier_invoice"), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9527
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9527
                                                                                                                                                                                                 | 
                                                             					'perms' => 1, 'label' => 'LinkToSupplierInvoice',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9528
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'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') . ')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9528
                                                                                                                                                                                                 | 
                                                            +					'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').')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9529
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9529
                                                                                                                                                                                                 | 
                                                             				'ticket' => array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9530
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9530
                                                                                                                                                                                                 | 
                                                             					'enabled' => isModEnabled('ticket'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9531
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9531
                                                                                                                                                                                                 | 
                                                             					'perms' => 1,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9532
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9532
                                                                                                                                                                                                 | 
                                                             					'label' => 'LinkToTicket',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9533
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'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') . ')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9533
                                                                                                                                                                                                 | 
                                                            +					'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').')'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9534
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9534
                                                                                                                                                                                                 | 
                                                             				'mo' => array(  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9535
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9535
                                                                                                                                                                                                 | 
                                                             					'enabled' => isModEnabled('mrp'), | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9536
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9536
                                                                                                                                                                                                 | 
                                                             					'perms' => 1,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9537
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9537
                                                                                                                                                                                                 | 
                                                             					'label' => 'LinkToMo',  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9538
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					'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') . ')') | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9538
                                                                                                                                                                                                 | 
                                                            +					'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').')') | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9539
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9539
                                                                                                                                                                                                 | 
                                                             			);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9540
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9540
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9541
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9541
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9571,22 +9571,22 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9571
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9571
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9572
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9572
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9573
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9573
                                                                                                                                                                                                 | 
                                                             			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9574
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9574
                                                                                                                                                                                                 | 
                                                            +				print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9575
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9575
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9576
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9576
                                                                                                                                                                                                 | 
                                                             				if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9577
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9577
                                                                                                                                                                                                 | 
                                                             					print '<br>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9578
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9578
                                                                                                                                                                                                 | 
                                                             					print '<!-- form to add a link from anywhere -->'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9579
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9580
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<input type="hidden" name="id" value="' . $object->id . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9579
                                                                                                                                                                                                 | 
                                                            +					print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9580
                                                                                                                                                                                                 | 
                                                            +					print '<input type="hidden" name="id" value="'.$object->id.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9581
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9581
                                                                                                                                                                                                 | 
                                                             					print '<input type="hidden" name="action" value="addlinkbyref">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9582
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9583
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<input type="hidden" name="addlink" value="' . $key . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9582
                                                                                                                                                                                                 | 
                                                            +					print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9583
                                                                                                                                                                                                 | 
                                                            +					print '<input type="hidden" name="addlink" value="'.$key.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9584
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9584
                                                                                                                                                                                                 | 
                                                             					print '<table class="noborder">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9585
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9585
                                                                                                                                                                                                 | 
                                                             					print '<tr>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9586
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9586
                                                                                                                                                                                                 | 
                                                             					//print '<td>' . $langs->trans("Ref") . '</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9587
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9588
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '"> '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9589
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9587
                                                                                                                                                                                                 | 
                                                            +					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9588
                                                                                                                                                                                                 | 
                                                            +					print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'"> '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9589
                                                                                                                                                                                                 | 
                                                            +					print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9590
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9590
                                                                                                                                                                                                 | 
                                                             					print '</tr>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9591
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9591
                                                                                                                                                                                                 | 
                                                             					print '</table>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9592
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9592
                                                                                                                                                                                                 | 
                                                             					print '</form>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9601,48 +9601,48 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9601
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9601
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9602
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9602
                                                                                                                                                                                                 | 
                                                             					print '<br>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9603
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9603
                                                                                                                                                                                                 | 
                                                             					print '<!-- form to add a link from object to same thirdparty -->'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9604
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9604
                                                                                                                                                                                                 | 
                                                            +					print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9605
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9605
                                                                                                                                                                                                 | 
                                                             					print '<input type="hidden" name="action" value="addlink">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9606
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9607
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<input type="hidden" name="id" value="' . $object->id . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9608
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<input type="hidden" name="addlink" value="' . $key . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9606
                                                                                                                                                                                                 | 
                                                            +					print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9607
                                                                                                                                                                                                 | 
                                                            +					print '<input type="hidden" name="id" value="'.$object->id.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9608
                                                                                                                                                                                                 | 
                                                            +					print '<input type="hidden" name="addlink" value="'.$key.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9609
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9609
                                                                                                                                                                                                 | 
                                                             					print '<table class="noborder">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9610
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9610
                                                                                                                                                                                                 | 
                                                             					print '<tr class="liste_titre">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9611
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9611
                                                                                                                                                                                                 | 
                                                             					print '<td class="nowrap"></td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9612
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<td class="center">' . $langs->trans("Ref") . '</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9613
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<td class="left">' . $langs->trans("RefCustomer") . '</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9614
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9615
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<td class="left">' . $langs->trans("Company") . '</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9612
                                                                                                                                                                                                 | 
                                                            +					print '<td class="center">'.$langs->trans("Ref").'</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9613
                                                                                                                                                                                                 | 
                                                            +					print '<td class="left">'.$langs->trans("RefCustomer").'</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9614
                                                                                                                                                                                                 | 
                                                            +					print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9615
                                                                                                                                                                                                 | 
                                                            +					print '<td class="left">'.$langs->trans("Company").'</td>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9616
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9616
                                                                                                                                                                                                 | 
                                                             					print '</tr>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9617
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9617
                                                                                                                                                                                                 | 
                                                             					while ($i < $num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9618
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9618
                                                                                                                                                                                                 | 
                                                             						$objp = $this->db->fetch_object($resqllist);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9619
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9619
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9620
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9620
                                                                                                                                                                                                 | 
                                                             						print '<tr class="oddeven">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9621
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9621
                                                                                                                                                                                                 | 
                                                             						print '<td class="left">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9622
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9622
                                                                                                                                                                                                 | 
                                                            +						print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9623
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9623
                                                                                                                                                                                                 | 
                                                             						print '</td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9624
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9625
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9624
                                                                                                                                                                                                 | 
                                                            +						print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9625
                                                                                                                                                                                                 | 
                                                            +						print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9626
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9626
                                                                                                                                                                                                 | 
                                                             						print '<td class="right">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9627
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9627
                                                                                                                                                                                                 | 
                                                             						if ($possiblelink['label'] == 'LinkToContract') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9628
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9628
                                                                                                                                                                                                 | 
                                                             							$form = new Form($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9629
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9629
                                                                                                                                                                                                 | 
                                                            +							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9630
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9630
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9631
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9631
                                                                                                                                                                                                 | 
                                                            +						print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9632
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9632
                                                                                                                                                                                                 | 
                                                             						print '</td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9633
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print '<td>' . $objp->name . '</td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9633
                                                                                                                                                                                                 | 
                                                            +						print '<td>'.$objp->name.'</td>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9634
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9634
                                                                                                                                                                                                 | 
                                                             						print '</tr>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9635
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9635
                                                                                                                                                                                                 | 
                                                             						$i++;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9636
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9636
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9637
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9637
                                                                                                                                                                                                 | 
                                                             					print '</table>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9638
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9638
                                                                                                                                                                                                 | 
                                                             					print '<div class="center">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9639
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9639
                                                                                                                                                                                                 | 
                                                             					if ($num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9640
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9640
                                                                                                                                                                                                 | 
                                                            +						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9641
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9641
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9642
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9642
                                                                                                                                                                                                 | 
                                                             					if (empty($conf->use_javascript_ajax)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9643
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9643
                                                                                                                                                                                                 | 
                                                            +						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9644
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9644
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9645
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						print '<input type="submit" onclick="jQuery(\'#' . $key . 'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9645
                                                                                                                                                                                                 | 
                                                            +						print '<input type="submit" onclick="jQuery(\'#'.$key.'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9646
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9646
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9647
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9647
                                                                                                                                                                                                 | 
                                                             					print '</form>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9648
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9648
                                                                                                                                                                                                 | 
                                                             					$this->db->free($resqllist);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9653,10 +9653,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9653
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9653
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9654
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9654
                                                                                                                                                                                                 | 
                                                             				//$linktoelem.=($linktoelem?'   ':'');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9655
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9655
                                                                                                                                                                                                 | 
                                                             				if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9656
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9656
                                                                                                                                                                                                 | 
                                                            +					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9657
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9657
                                                                                                                                                                                                 | 
                                                             					// } else $linktoelem.=$langs->trans($possiblelink['label']);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9658
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9658
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9659
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9659
                                                                                                                                                                                                 | 
                                                            +					$linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9660
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9660
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9661
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9661
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9662
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9662
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9666,11 +9666,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9666
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9666
                                                                                                                                                                                                 | 
                                                                 		<dl class="dropdown" id="linktoobjectname">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9667
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9667
                                                                                                                                                                                                 | 
                                                                 		';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9668
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9668
                                                                                                                                                                                                 | 
                                                             			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9669
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9669
                                                                                                                                                                                                 | 
                                                            +				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9670
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9670
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9671
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9671
                                                                                                                                                                                                 | 
                                                             			$linktoelem .= '<dd>  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9672
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9672
                                                                                                                                                                                                 | 
                                                                 		<div class="multiselectlinkto">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9673
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -    		<ul class="ulselectedfields">' . $linktoelemlist . '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9673
                                                                                                                                                                                                 | 
                                                            +    		<ul class="ulselectedfields">' . $linktoelemlist.'  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9674
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9674
                                                                                                                                                                                                 | 
                                                                 		</ul>  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9675
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9675
                                                                                                                                                                                                 | 
                                                                 		</div>  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9676
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9676
                                                                                                                                                                                                 | 
                                                                 		</dd>  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9681,7 +9681,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9681
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9681
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9682
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9682
                                                                                                                                                                                                 | 
                                                             		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9683
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9683
                                                                                                                                                                                                 | 
                                                             			print '<!-- Add js to show linkto box -->  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9684
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				<script nonce="' . getNonce() . '">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9684
                                                                                                                                                                                                 | 
                                                            +				<script nonce="' . getNonce().'">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9685
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9685
                                                                                                                                                                                                 | 
                                                             				jQuery(document).ready(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9686
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9686
                                                                                                                                                                                                 | 
                                                             					jQuery(".linkto").click(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9687
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9687
                                                                                                                                                                                                 | 
                                                             						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9722,19 +9722,19 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9722
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9722
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9723
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9723
                                                                                                                                                                                                 | 
                                                             		$disabled = ($disabled ? ' disabled' : '');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9724
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9724
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9725
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$resultyesno = '<select class="flat width75' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9725
                                                                                                                                                                                                 | 
                                                            +		$resultyesno = '<select class="flat width75'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9726
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9726
                                                                                                                                                                                                 | 
                                                             		if ($useempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9727
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9727
                                                                                                                                                                                                 | 
                                                            +			$resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9728
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9728
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9729
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9729
                                                                                                                                                                                                 | 
                                                             		if (("$value" == 'yes') || ($value == 1)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9730
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9731
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9730
                                                                                                                                                                                                 | 
                                                            +			$resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9731
                                                                                                                                                                                                 | 
                                                            +			$resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9732
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9732
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9733
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9733
                                                                                                                                                                                                 | 
                                                             			$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9734
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9735
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9734
                                                                                                                                                                                                 | 
                                                            +			$resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9735
                                                                                                                                                                                                 | 
                                                            +			$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9736
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9736
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9737
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$resultyesno .= '</select>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9737
                                                                                                                                                                                                 | 
                                                            +		$resultyesno .= '</select>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9738
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9738
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9739
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9739
                                                                                                                                                                                                 | 
                                                             		if ($addjscombo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9740
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9740
                                                                                                                                                                                                 | 
                                                             			$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9758,12 +9758,12 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9758
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9758
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9759
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9759
                                                                                                                                                                                                 | 
                                                             		// phpcs:enable  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9760
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9760
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT rowid, label";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9761
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "export_model";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9762
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE type = '" . $this->db->escape($type) . "'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9761
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."export_model";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9762
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE type = '".$this->db->escape($type)."'";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9763
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9763
                                                                                                                                                                                                 | 
                                                             		$sql .= " ORDER BY rowid";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9764
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9764
                                                                                                                                                                                                 | 
                                                             		$result = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9765
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9765
                                                                                                                                                                                                 | 
                                                             		if ($result) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9766
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9766
                                                                                                                                                                                                 | 
                                                            +			print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9767
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9767
                                                                                                                                                                                                 | 
                                                             			if ($useempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9768
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9768
                                                                                                                                                                                                 | 
                                                             				print '<option value="-1"> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9769
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9769
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9773,9 +9773,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9773
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9773
                                                                                                                                                                                                 | 
                                                             			while ($i < $num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9774
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9774
                                                                                                                                                                                                 | 
                                                             				$obj = $this->db->fetch_object($result);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9775
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9775
                                                                                                                                                                                                 | 
                                                             				if ($selected == $obj->rowid) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9776
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9776
                                                                                                                                                                                                 | 
                                                            +					print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9777
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9777
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9778
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					print '<option value="' . $obj->rowid . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9778
                                                                                                                                                                                                 | 
                                                            +					print '<option value="'.$obj->rowid.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9779
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9779
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9780
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9780
                                                                                                                                                                                                 | 
                                                             				print $obj->label;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9781
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9781
                                                                                                                                                                                                 | 
                                                             				print '</option>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9866,8 +9866,8 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9866
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9866
                                                                                                                                                                                                 | 
                                                             				$stringforfirstkey .= ' CTL +';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9867
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9867
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9868
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9868
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9869
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$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>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9870
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$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>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9869
                                                                                                                                                                                                 | 
                                                            +			$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>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9870
                                                                                                                                                                                                 | 
                                                            +			$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>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9871
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9871
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9872
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9872
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9873
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9873
                                                                                                                                                                                                 | 
                                                             		//print "xx".$previous_ref."x".$next_ref;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9875,18 +9875,18 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9875
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9875
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9876
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9876
                                                                                                                                                                                                 | 
                                                             		// Right part of banner  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9877
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9877
                                                                                                                                                                                                 | 
                                                             		if ($morehtmlright) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9878
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9878
                                                                                                                                                                                                 | 
                                                            +			$ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9879
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9879
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9880
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9880
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9881
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9881
                                                                                                                                                                                                 | 
                                                             		if ($previous_ref || $next_ref || $morehtml) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9882
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9882
                                                                                                                                                                                                 | 
                                                             			$ret .= '<div class="pagination paginationref"><ul class="right">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9883
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9883
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9884
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9884
                                                                                                                                                                                                 | 
                                                             		if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9885
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9885
                                                                                                                                                                                                 | 
                                                            +			$ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9886
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9886
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9887
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9887
                                                                                                                                                                                                 | 
                                                             		if ($shownav && ($previous_ref || $next_ref)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9888
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= '<li class="pagination">' . $previous_ref . '</li>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9889
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= '<li class="pagination">' . $next_ref . '</li>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9888
                                                                                                                                                                                                 | 
                                                            +			$ret .= '<li class="pagination">'.$previous_ref.'</li>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9889
                                                                                                                                                                                                 | 
                                                            +			$ret .= '<li class="pagination">'.$next_ref.'</li>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9890
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9890
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9891
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9891
                                                                                                                                                                                                 | 
                                                             		if ($previous_ref || $next_ref || $morehtml) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9892
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9892
                                                                                                                                                                                                 | 
                                                             			$ret .= '</ul></div>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9901,7 +9901,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9901
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9901
                                                                                                                                                                                                 | 
                                                             			$morehtmlstatus = $hookmanager->resPrint;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9902
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9902
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9903
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9903
                                                                                                                                                                                                 | 
                                                             		if ($morehtmlstatus) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9904
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9904
                                                                                                                                                                                                 | 
                                                            +			$ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9905
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9905
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9906
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9906
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9907
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9907
                                                                                                                                                                                                 | 
                                                             		$parameters = array();  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9915,14 +9915,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9915
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9915
                                                                                                                                                                                                 | 
                                                             		// Left part of banner  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9916
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9916
                                                                                                                                                                                                 | 
                                                             		if ($morehtmlleft) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9917
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9917
                                                                                                                                                                                                 | 
                                                             			if ($conf->browser->layout == 'phone') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9918
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9918
                                                                                                                                                                                                 | 
                                                            +				$ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9919
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9919
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9920
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9920
                                                                                                                                                                                                 | 
                                                            +				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9921
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9921
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9922
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9922
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9923
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9923
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9924
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9924
                                                                                                                                                                                                 | 
                                                             		//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9925
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9925
                                                                                                                                                                                                 | 
                                                            +		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9926
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9926
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9927
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9927
                                                                                                                                                                                                 | 
                                                             		// For thirdparty, contact, user, member, the ref is the id, so we show something else  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9928
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9928
                                                                                                                                                                                                 | 
                                                             		if ($object->element == 'societe') { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9936,7 +9936,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9936
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9936
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9937
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9937
                                                                                                                                                                                                 | 
                                                             			if (is_array($arrayoflangcode) && count($arrayoflangcode)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9938
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9938
                                                                                                                                                                                                 | 
                                                             				if (!is_object($extralanguages)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9939
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9939
                                                                                                                                                                                                 | 
                                                            +					include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9940
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9940
                                                                                                                                                                                                 | 
                                                             					$extralanguages = new ExtraLanguages($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9941
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9941
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9942
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9942
                                                                                                                                                                                                 | 
                                                             				$extralanguages->fetch_name_extralanguages('societe'); | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -9951,29 +9951,29 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    9951
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9951
                                                                                                                                                                                                 | 
                                                             						if ($object->array_languages['name'][$extralangcode]) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9952
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9952
                                                                                                                                                                                                 | 
                                                             							$htmltext .= $object->array_languages['name'][$extralangcode];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9953
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9953
                                                                                                                                                                                                 | 
                                                             						} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9954
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9954
                                                                                                                                                                                                 | 
                                                            +							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9955
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9955
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9956
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9956
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9957
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<!-- Show translations of name -->' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9957
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<!-- Show translations of name -->'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9958
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9958
                                                                                                                                                                                                 | 
                                                             					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9959
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9959
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9960
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9960
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9961
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9961
                                                                                                                                                                                                 | 
                                                             		} elseif ($object->element == 'member') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9962
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9962
                                                                                                                                                                                                 | 
                                                             			'@phan-var-force Adherent $object';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9963
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= $object->ref . '<br>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9963
                                                                                                                                                                                                 | 
                                                            +			$ret .= $object->ref.'<br>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9964
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9964
                                                                                                                                                                                                 | 
                                                             			$fullname = $object->getFullName($langs);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9965
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9965
                                                                                                                                                                                                 | 
                                                             			if ($object->morphy == 'mor' && $object->societe) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9966
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9966
                                                                                                                                                                                                 | 
                                                            +				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9967
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9967
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9968
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9968
                                                                                                                                                                                                 | 
                                                            +				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9969
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9969
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9970
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9970
                                                                                                                                                                                                 | 
                                                             		} elseif (in_array($object->element, array('contact', 'user'))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9971
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9971
                                                                                                                                                                                                 | 
                                                            +			$ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9972
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9972
                                                                                                                                                                                                 | 
                                                             		} elseif ($object->element == 'usergroup') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9973
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9973
                                                                                                                                                                                                 | 
                                                             			$ret .= dol_htmlentities($object->name);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9974
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9974
                                                                                                                                                                                                 | 
                                                             		} elseif (in_array($object->element, array('action', 'agenda'))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9975
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9975
                                                                                                                                                                                                 | 
                                                             			'@phan-var-force ActionComm $object';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9976
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$ret .= $object->ref . '<br>' . $object->label;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    9976
                                                                                                                                                                                                 | 
                                                            +			$ret .= $object->ref.'<br>'.$object->label;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9977
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9977
                                                                                                                                                                                                 | 
                                                             		} elseif (in_array($object->element, array('adherent_type'))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9978
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9978
                                                                                                                                                                                                 | 
                                                             			$ret .= $object->label;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    9979
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    9979
                                                                                                                                                                                                 | 
                                                             		} elseif ($object->element == 'ecm_directories') { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10026,9 +10026,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10026
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10026
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10027
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10027
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10028
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10028
                                                                                                                                                                                                 | 
                                                             		// Barcode image  @phan-suppress-next-line PhanUndeclaredProperty  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10029
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10030
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out = '<!-- url barcode = ' . $url . ' -->';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10031
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10029
                                                                                                                                                                                                 | 
                                                            +		$url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10030
                                                                                                                                                                                                 | 
                                                            +		$out = '<!-- url barcode = '.$url.' -->';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10031
                                                                                                                                                                                                 | 
                                                            +		$out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10032
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10032
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10033
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10033
                                                                                                                                                                                                 | 
                                                             		return $out;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10034
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10034
                                                                                                                                                                                                 | 
                                                             	}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10055,7 +10055,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10055
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10055
                                                                                                                                                                                                 | 
                                                             		global $conf, $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10056
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10056
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10057
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10057
                                                                                                                                                                                                 | 
                                                             		$entity = (empty($object->entity) ? $conf->entity : $object->entity);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10058
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$id = (empty($object->id) ? $object->rowid : $object->id);  // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10058
                                                                                                                                                                                                 | 
                                                            +		$id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10059
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10059
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10060
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10060
                                                                                                                                                                                                 | 
                                                             		$dir = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10061
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10061
                                                                                                                                                                                                 | 
                                                             		$file = '';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10068,28 +10068,28 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10068
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10068
                                                                                                                                                                                                 | 
                                                             			if (!empty($object->logo)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10069
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10069
                                                                                                                                                                                                 | 
                                                             				if (dolIsAllowedForPreview($object->logo)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10070
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10070
                                                                                                                                                                                                 | 
                                                             					if ((string) $imagesize == 'mini') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10071
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10071
                                                                                                                                                                                                 | 
                                                            +						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10072
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10072
                                                                                                                                                                                                 | 
                                                             					} elseif ((string) $imagesize == 'small') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10073
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10073
                                                                                                                                                                                                 | 
                                                            +						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10074
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10074
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10075
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10075
                                                                                                                                                                                                 | 
                                                            +						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10076
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10076
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10077
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10077
                                                                                                                                                                                                 | 
                                                            +					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10078
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10078
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10079
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10079
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10080
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10080
                                                                                                                                                                                                 | 
                                                             			$email = $object->email;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10081
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10081
                                                                                                                                                                                                 | 
                                                             		} elseif ($modulepart == 'contact') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10082
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$dir = $conf->societe->multidir_output[$entity] . '/contact';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10082
                                                                                                                                                                                                 | 
                                                            +			$dir = $conf->societe->multidir_output[$entity].'/contact';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10083
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10083
                                                                                                                                                                                                 | 
                                                             			if (!empty($object->photo)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10084
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10084
                                                                                                                                                                                                 | 
                                                             				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10085
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10085
                                                                                                                                                                                                 | 
                                                             					if ((string) $imagesize == 'mini') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10086
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10086
                                                                                                                                                                                                 | 
                                                            +						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10087
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10087
                                                                                                                                                                                                 | 
                                                             					} elseif ((string) $imagesize == 'small') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10088
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10088
                                                                                                                                                                                                 | 
                                                            +						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10089
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10089
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10090
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10090
                                                                                                                                                                                                 | 
                                                            +						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10091
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10091
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10092
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10092
                                                                                                                                                                                                 | 
                                                            +					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10093
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10093
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10094
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10094
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10095
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10095
                                                                                                                                                                                                 | 
                                                             			$email = $object->email;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10099,17 +10099,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10099
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10099
                                                                                                                                                                                                 | 
                                                             			if (!empty($object->photo)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10100
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10100
                                                                                                                                                                                                 | 
                                                             				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10101
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10101
                                                                                                                                                                                                 | 
                                                             					if ((string) $imagesize == 'mini') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10102
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10102
                                                                                                                                                                                                 | 
                                                            +						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10103
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10103
                                                                                                                                                                                                 | 
                                                             					} elseif ((string) $imagesize == 'small') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10104
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10104
                                                                                                                                                                                                 | 
                                                            +						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10105
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10105
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10106
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10106
                                                                                                                                                                                                 | 
                                                            +						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10107
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10107
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10108
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10108
                                                                                                                                                                                                 | 
                                                            +					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10109
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10109
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10110
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10110
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10111
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10111
                                                                                                                                                                                                 | 
                                                             			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10112
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$altfile = $object->id . ".jpg"; // For backward compatibility  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10112
                                                                                                                                                                                                 | 
                                                            +				$altfile = $object->id.".jpg"; // For backward compatibility  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10113
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10113
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10114
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10114
                                                                                                                                                                                                 | 
                                                             			$email = $object->email;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10115
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10115
                                                                                                                                                                                                 | 
                                                             			$capture = 'user';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10118,17 +10118,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10118
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10118
                                                                                                                                                                                                 | 
                                                             			if (!empty($object->photo)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10119
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10119
                                                                                                                                                                                                 | 
                                                             				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10120
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10120
                                                                                                                                                                                                 | 
                                                             					if ((string) $imagesize == 'mini') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10121
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10121
                                                                                                                                                                                                 | 
                                                            +						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10122
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10122
                                                                                                                                                                                                 | 
                                                             					} elseif ((string) $imagesize == 'small') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10123
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10123
                                                                                                                                                                                                 | 
                                                            +						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10124
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10124
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10125
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10125
                                                                                                                                                                                                 | 
                                                            +						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10126
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10126
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10127
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10127
                                                                                                                                                                                                 | 
                                                            +					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10128
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10128
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10129
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10129
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10130
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10130
                                                                                                                                                                                                 | 
                                                             			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10131
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$altfile = $object->id . ".jpg"; // For backward compatibility  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10131
                                                                                                                                                                                                 | 
                                                            +				$altfile = $object->id.".jpg"; // For backward compatibility  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10132
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10132
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10133
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10133
                                                                                                                                                                                                 | 
                                                             			$email = $object->email;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10134
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10134
                                                                                                                                                                                                 | 
                                                             			$capture = 'user';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10154,35 +10154,35 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10154
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10154
                                                                                                                                                                                                 | 
                                                             		$ret = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10155
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10155
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10156
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10156
                                                                                                                                                                                                 | 
                                                             		if ($dir) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10157
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			if ($file && file_exists($dir . "/" . $file)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10157
                                                                                                                                                                                                 | 
                                                            +			if ($file && file_exists($dir."/".$file)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10158
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10158
                                                                                                                                                                                                 | 
                                                             				if ($addlinktofullsize) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10159
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10159
                                                                                                                                                                                                 | 
                                                            +					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10160
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10160
                                                                                                                                                                                                 | 
                                                             					if ($urladvanced) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10161
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$ret .= '<a href="' . $urladvanced . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10161
                                                                                                                                                                                                 | 
                                                            +						$ret .= '<a href="'.$urladvanced.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10162
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10162
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10163
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10163
                                                                                                                                                                                                 | 
                                                            +						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10164
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10164
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10165
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10165
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10166
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$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 . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10166
                                                                                                                                                                                                 | 
                                                            +				$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.'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10167
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10167
                                                                                                                                                                                                 | 
                                                             				if ($addlinktofullsize) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10168
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10168
                                                                                                                                                                                                 | 
                                                             					$ret .= '</a>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10169
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10169
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10170
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			} elseif ($altfile && file_exists($dir . "/" . $altfile)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10170
                                                                                                                                                                                                 | 
                                                            +			} elseif ($altfile && file_exists($dir."/".$altfile)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10171
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10171
                                                                                                                                                                                                 | 
                                                             				if ($addlinktofullsize) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10172
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10172
                                                                                                                                                                                                 | 
                                                            +					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10173
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10173
                                                                                                                                                                                                 | 
                                                             					if ($urladvanced) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10174
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$ret .= '<a href="' . $urladvanced . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10174
                                                                                                                                                                                                 | 
                                                            +						$ret .= '<a href="'.$urladvanced.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10175
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10175
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10176
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10176
                                                                                                                                                                                                 | 
                                                            +						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10177
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10177
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10178
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10178
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10179
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$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 . '">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10179
                                                                                                                                                                                                 | 
                                                            +				$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.'">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10180
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10180
                                                                                                                                                                                                 | 
                                                             				if ($addlinktofullsize) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10181
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10181
                                                                                                                                                                                                 | 
                                                             					$ret .= '</a>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10182
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10182
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10183
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10183
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10184
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10184
                                                                                                                                                                                                 | 
                                                             				$nophoto = '/public/theme/common/nophoto.png';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10185
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$defaultimg = 'identicon';        // For gravatar  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10185
                                                                                                                                                                                                 | 
                                                            +				$defaultimg = 'identicon'; // For gravatar  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10186
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10186
                                                                                                                                                                                                 | 
                                                             				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10187
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10187
                                                                                                                                                                                                 | 
                                                             					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10188
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10188
                                                                                                                                                                                                 | 
                                                             						$nophoto = 'company';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10200,13 +10200,13 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10200
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10200
                                                                                                                                                                                                 | 
                                                             				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10201
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10201
                                                                                                                                                                                                 | 
                                                             					// see https://gravatar.com/site/implement/images/php/  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10202
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10202
                                                                                                                                                                                                 | 
                                                             					$ret .= '<!-- Put link to gravatar -->';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10203
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$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  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10203
                                                                                                                                                                                                 | 
                                                            +					$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  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10204
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10204
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10205
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10205
                                                                                                                                                                                                 | 
                                                             					if ($nophoto == 'company') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10206
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10206
                                                                                                                                                                                                 | 
                                                            +						$ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10207
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10207
                                                                                                                                                                                                 | 
                                                             						//$ret .= '<div class="difforspanimgright"></div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10208
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10208
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10209
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10209
                                                                                                                                                                                                 | 
                                                            +						$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10210
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10210
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10211
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10211
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10212
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10212
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10217,15 +10217,15 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10217
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10217
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10218
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10218
                                                                                                                                                                                                 | 
                                                             				$ret .= '<table class="nobordernopadding centpercent">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10219
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10219
                                                                                                                                                                                                 | 
                                                             				if ($object->photo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10220
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10220
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10221
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10221
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10222
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10222
                                                                                                                                                                                                 | 
                                                             				$ret .= '<tr><td class="tdoverflow">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10223
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10223
                                                                                                                                                                                                 | 
                                                             				$maxfilesizearray = getMaxFileSizeArray();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10224
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10224
                                                                                                                                                                                                 | 
                                                             				$maxmin = $maxfilesizearray['maxmin'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10225
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10225
                                                                                                                                                                                                 | 
                                                             				if ($maxmin > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10226
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">';    // MAX_FILE_SIZE must precede the field type=file  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10226
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10227
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10227
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10228
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10228
                                                                                                                                                                                                 | 
                                                            +				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10229
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10229
                                                                                                                                                                                                 | 
                                                             				$ret .= '</td></tr>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10230
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10230
                                                                                                                                                                                                 | 
                                                             				$ret .= '</table>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10231
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10231
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10279,38 +10279,38 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10279
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10279
                                                                                                                                                                                                 | 
                                                             		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10280
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10280
                                                                                                                                                                                                 | 
                                                             			$sql .= ", e.label";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10281
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10281
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10282
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . $this->db->prefix() . "usergroup as ug ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10282
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".$this->db->prefix()."usergroup as ug ";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10283
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10283
                                                                                                                                                                                                 | 
                                                             		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10284
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10284
                                                                                                                                                                                                 | 
                                                            +			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10285
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10285
                                                                                                                                                                                                 | 
                                                             			if ($force_entity) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10286
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql .= " WHERE ug.entity IN (0, " . $force_entity . ")";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10286
                                                                                                                                                                                                 | 
                                                            +				$sql .= " WHERE ug.entity IN (0, ".$force_entity.")";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10287
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10287
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10288
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10288
                                                                                                                                                                                                 | 
                                                             				$sql .= " WHERE ug.entity IS NOT NULL";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10289
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10289
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10290
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10290
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10291
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10291
                                                                                                                                                                                                 | 
                                                            +			$sql .= " WHERE ug.entity IN (0, ".$conf->entity.")";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10292
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10292
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10293
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10293
                                                                                                                                                                                                 | 
                                                             		if (is_array($exclude) && $excludeGroups) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10294
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10294
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10295
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10295
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10296
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10296
                                                                                                                                                                                                 | 
                                                             		if (is_array($include) && $includeGroups) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10297
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10297
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10298
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10298
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10299
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10299
                                                                                                                                                                                                 | 
                                                             		$sql .= " ORDER BY ug.nom ASC";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10300
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10300
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10301
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10301
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10302
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10302
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10303
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10303
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10304
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10304
                                                                                                                                                                                                 | 
                                                             			// Enhance with select2  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10305
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10305
                                                                                                                                                                                                 | 
                                                            +			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10306
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10306
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10307
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10307
                                                                                                                                                                                                 | 
                                                            +			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10308
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10308
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10309
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10309
                                                                                                                                                                                                 | 
                                                             			$num = $this->db->num_rows($resql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10310
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10310
                                                                                                                                                                                                 | 
                                                             			$i = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10311
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10311
                                                                                                                                                                                                 | 
                                                             			if ($num) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10312
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10312
                                                                                                                                                                                                 | 
                                                             				if ($show_empty && !$multiple) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10313
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10313
                                                                                                                                                                                                 | 
                                                            +					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10314
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10314
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10315
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10315
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10316
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10316
                                                                                                                                                                                                 | 
                                                             				while ($i < $num) { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10323,11 +10323,11 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10323
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10323
                                                                                                                                                                                                 | 
                                                             					$label = $obj->name;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10324
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10324
                                                                                                                                                                                                 | 
                                                             					$labelhtml = $obj->name;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10325
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10325
                                                                                                                                                                                                 | 
                                                             					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10326
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$label .= " (" . $obj->label . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10327
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10326
                                                                                                                                                                                                 | 
                                                            +						$label .= " (".$obj->label.")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10327
                                                                                                                                                                                                 | 
                                                            +						$labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10328
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10328
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10329
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10329
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10330
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<option value="' . $obj->rowid . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10330
                                                                                                                                                                                                 | 
                                                            +					$out .= '<option value="'.$obj->rowid.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10331
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10331
                                                                                                                                                                                                 | 
                                                             					if ($disableline) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10332
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10332
                                                                                                                                                                                                 | 
                                                             						$out .= ' disabled';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10333
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10333
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10343,9 +10343,9 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10343
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10343
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10344
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10344
                                                                                                                                                                                                 | 
                                                             			} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10345
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10345
                                                                                                                                                                                                 | 
                                                             				if ($show_empty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10346
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10346
                                                                                                                                                                                                 | 
                                                            +					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10347
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10347
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10348
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10348
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10349
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10349
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10350
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10350
                                                                                                                                                                                                 | 
                                                             			$out .= '</select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10351
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10351
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10389,25 +10389,25 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10389
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10389
                                                                                                                                                                                                 | 
                                                             		$out = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10390
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10390
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10391
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10391
                                                                                                                                                                                                 | 
                                                             		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10392
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10392
                                                                                                                                                                                                 | 
                                                            +			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10393
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10393
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10394
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out .= '<script nonce="' . getNonce() . '">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10394
                                                                                                                                                                                                 | 
                                                            +		$out .= '<script nonce="'.getNonce().'">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10395
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10395
                                                                                                                                                                                                 | 
                                                                         $(document).ready(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10396
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                $("#' . $cssclass . 's").click(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10396
                                                                                                                                                                                                 | 
                                                            +                $("#' . $cssclass.'s").click(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10397
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10397
                                                                                                                                                                                                 | 
                                                                                 if($(this).is(\':checked\')){ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10398
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                        console.log("We check all ' . $cssclass . ' and trigger the change method"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10399
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10398
                                                                                                                                                                                                 | 
                                                            +                        console.log("We check all ' . $cssclass.' and trigger the change method"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10399
                                                                                                                                                                                                 | 
                                                            +                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10400
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10400
                                                                                                                                                                                                 | 
                                                                                 }  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10401
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10401
                                                                                                                                                                                                 | 
                                                                                 else  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10402
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10402
                                                                                                                                                                                                 | 
                                                                                 { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10403
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10403
                                                                                                                                                                                                 | 
                                                                                     console.log("We uncheck all"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10404
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10404
                                                                                                                                                                                                 | 
                                                            +                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10405
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10405
                                                                                                                                                                                                 | 
                                                                                 }' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10406
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10406
                                                                                                                                                                                                 | 
                                                             		if ($calljsfunction) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10407
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10407
                                                                                                                                                                                                 | 
                                                            +			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10408
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10408
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10409
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10409
                                                                                                                                                                                                 | 
                                                             		$out .= '         });  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10410
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -        	        $(".' . $cssclass . '").change(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10410
                                                                                                                                                                                                 | 
                                                            +        	        $(".' . $cssclass.'").change(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10411
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10411
                                                                                                                                                                                                 | 
                                                             					$(this).closest("tr").toggleClass("highlight", this.checked); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10412
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10412
                                                                                                                                                                                                 | 
                                                             				});  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10413
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10413
                                                                                                                                                                                                 | 
                                                             		 	});  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10452,67 +10452,67 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10452
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10452
                                                                                                                                                                                                 | 
                                                             		global $langs, $user;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10453
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10453
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10454
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10454
                                                                                                                                                                                                 | 
                                                             		$out = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10455
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10456
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10455
                                                                                                                                                                                                 | 
                                                            +		$sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10456
                                                                                                                                                                                                 | 
                                                            +		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10457
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10457
                                                                                                                                                                                                 | 
                                                             		if (!empty($excludeid)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10458
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10458
                                                                                                                                                                                                 | 
                                                            +			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10459
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10459
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10460
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10460
                                                                                                                                                                                                 | 
                                                             		$sql .= " ORDER BY label";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10461
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10461
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10462
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10462
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10463
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10463
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10464
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10464
                                                                                                                                                                                                 | 
                                                            +			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10465
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10465
                                                                                                                                                                                                 | 
                                                             			if ($useempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10466
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10466
                                                                                                                                                                                                 | 
                                                             				$out .= '<option value="0"> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10467
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10467
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10468
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10468
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10469
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10469
                                                                                                                                                                                                 | 
                                                             			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10470
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10470
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10471
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10471
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10472
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10472
                                                                                                                                                                                                 | 
                                                             			$out .= '</select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10473
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= ajax_combobox('select_' . $htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10473
                                                                                                                                                                                                 | 
                                                            +			$out .= ajax_combobox('select_'.$htmlname); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10474
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10474
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10475
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10475
                                                                                                                                                                                                 | 
                                                             			if (!empty($htmlname) && $user->admin && $info_admin) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10476
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10476
                                                                                                                                                                                                 | 
                                                            +				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10477
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10477
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10478
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10478
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10479
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10479
                                                                                                                                                                                                 | 
                                                             			if (!empty($target)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10480
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10480
                                                                                                                                                                                                 | 
                                                            +				$sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10481
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10481
                                                                                                                                                                                                 | 
                                                             				$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10482
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10482
                                                                                                                                                                                                 | 
                                                             				if ($resql) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10483
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10483
                                                                                                                                                                                                 | 
                                                             					if ($this->db->num_rows($resql) > 0) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10484
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10484
                                                                                                                                                                                                 | 
                                                             						$obj = $this->db->fetch_object($resql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10485
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '<script nonce="' . getNonce() . '">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10485
                                                                                                                                                                                                 | 
                                                            +						$out .= '<script nonce="'.getNonce().'">  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10486
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10486
                                                                                                                                                                                                 | 
                                                             							$(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10487
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$("select[name=' . $target . ']").on("change", function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10487
                                                                                                                                                                                                 | 
                                                            +								$("select[name=' . $target.']").on("change", function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10488
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10488
                                                                                                                                                                                                 | 
                                                             									var current_val = $(this).val();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10489
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -									if (current_val == ' . $obj->id . ') {'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10489
                                                                                                                                                                                                 | 
                                                            +									if (current_val == ' . $obj->id.') {'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10490
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10490
                                                                                                                                                                                                 | 
                                                             						if (!empty($default_selected) || !empty($selected)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10491
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10491
                                                                                                                                                                                                 | 
                                                            +							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10492
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10492
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10493
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10493
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10494
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10494
                                                                                                                                                                                                 | 
                                                             						$out .= '  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10495
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -										$("select[name=' . $htmlname . ']").change(); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10495
                                                                                                                                                                                                 | 
                                                            +										$("select[name=' . $htmlname.']").change(); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10496
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10496
                                                                                                                                                                                                 | 
                                                             									}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10497
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10497
                                                                                                                                                                                                 | 
                                                             								});  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10498
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10498
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10499
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$("select[name=' . $htmlname . ']").change(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10499
                                                                                                                                                                                                 | 
                                                            +								$("select[name=' . $htmlname.']").change(function() { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10500
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10500
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10501
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10501
                                                                                                                                                                                                 | 
                                                            +									if ($("select[name=' . $target.']").val() == '.$obj->id.') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10502
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10502
                                                                                                                                                                                                 | 
                                                             										// get price of kilometer to fill the unit price  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10503
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10503
                                                                                                                                                                                                 | 
                                                             										$.ajax({ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10504
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10504
                                                                                                                                                                                                 | 
                                                             											method: "POST",  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10505
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10505
                                                                                                                                                                                                 | 
                                                             											dataType: "json",  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10506
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10507
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '", | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10506
                                                                                                                                                                                                 | 
                                                            +											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10507
                                                                                                                                                                                                 | 
                                                            +											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'", | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10508
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10508
                                                                                                                                                                                                 | 
                                                             										}).done(function( data, textStatus, jqXHR ) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10509
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10509
                                                                                                                                                                                                 | 
                                                             											console.log(data);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10510
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10510
                                                                                                                                                                                                 | 
                                                             											if (typeof data.up != "undefined") { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10511
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10511
                                                                                                                                                                                                 | 
                                                             												$("input[name=value_unit]").val(data.up); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10512
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -												$("select[name=' . $htmlname . ']").attr("title", data.title); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10512
                                                                                                                                                                                                 | 
                                                            +												$("select[name=' . $htmlname.']").attr("title", data.title); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10513
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10513
                                                                                                                                                                                                 | 
                                                             											} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10514
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10514
                                                                                                                                                                                                 | 
                                                             												$("input[name=value_unit]").val(""); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10515
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -												$("select[name=' . $htmlname . ']").attr("title", ""); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10515
                                                                                                                                                                                                 | 
                                                            +												$("select[name=' . $htmlname.']").attr("title", ""); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10516
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10516
                                                                                                                                                                                                 | 
                                                             											}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10517
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10517
                                                                                                                                                                                                 | 
                                                             										});  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10518
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10518
                                                                                                                                                                                                 | 
                                                             									}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10542,18 +10542,18 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10542
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10542
                                                                                                                                                                                                 | 
                                                             		global $conf, $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10543
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10543
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10544
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10544
                                                                                                                                                                                                 | 
                                                             		$out = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10545
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10546
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE entity = " . $conf->entity . " AND active = 1";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10545
                                                                                                                                                                                                 | 
                                                            +		$sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10546
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE entity = ".$conf->entity." AND active = 1";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10547
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10547
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10548
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10548
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10549
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10549
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10550
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10550
                                                                                                                                                                                                 | 
                                                            +			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10551
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10551
                                                                                                                                                                                                 | 
                                                             			if ($useempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10552
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10552
                                                                                                                                                                                                 | 
                                                             				$out .= '<option value="0"></option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10553
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10553
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10554
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10554
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10555
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10555
                                                                                                                                                                                                 | 
                                                             			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10556
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10556
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10557
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10557
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10558
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10558
                                                                                                                                                                                                 | 
                                                             			$out .= '</select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10559
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10559
                                                                                                                                                                                                 | 
                                                             		} else { | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10584,12 +10584,12 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10584
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10584
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10585
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10585
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10586
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10586
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10587
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10587
                                                                                                                                                                                                 | 
                                                            +			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10588
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10588
                                                                                                                                                                                                 | 
                                                             			if ($useempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10589
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10589
                                                                                                                                                                                                 | 
                                                             				$out .= '<option value="0"></option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10590
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10590
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10591
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10591
                                                                                                                                                                                                 | 
                                                             			if ($allchoice) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10592
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10592
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10593
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10593
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10594
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10594
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10595
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10595
                                                                                                                                                                                                 | 
                                                             			$field = 'code';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10599,7 +10599,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10599
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10599
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10600
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10600
                                                                                                                                                                                                 | 
                                                             			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10601
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10601
                                                                                                                                                                                                 | 
                                                             				$key = $langs->trans($obj->code);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10602
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10602
                                                                                                                                                                                                 | 
                                                            +				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10603
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10603
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10604
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10604
                                                                                                                                                                                                 | 
                                                             			$out .= '</select>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10605
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10605
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10633,7 +10633,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10633
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10633
                                                                                                                                                                                                 | 
                                                             	{ | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10634
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10634
                                                                                                                                                                                                 | 
                                                             		global $user, $conf, $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10635
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10635
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10636
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10636
                                                                                                                                                                                                 | 
                                                            +		require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10637
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10637
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10638
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10638
                                                                                                                                                                                                 | 
                                                             		if (is_null($usertofilter)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10639
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10639
                                                                                                                                                                                                 | 
                                                             			$usertofilter = $user;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10657,10 +10657,10 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10657
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10657
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10658
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10658
                                                                                                                                                                                                 | 
                                                                         p.title, p.fk_soc, p.fk_statut, p.public,";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10659
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10659
                                                                                                                                                                                                 | 
                                                             		$sql .= ' s.nom as name';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10660
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= ' FROM ' . $this->db->prefix() . 'projet as p';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10661
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10662
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= ' ' . $this->db->prefix() . 'facture as f';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10663
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10660
                                                                                                                                                                                                 | 
                                                            +		$sql .= ' FROM '.$this->db->prefix().'projet as p';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10661
                                                                                                                                                                                                 | 
                                                            +		$sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10662
                                                                                                                                                                                                 | 
                                                            +		$sql .= ' '.$this->db->prefix().'facture as f';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10663
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE p.entity IN (".getEntity('project').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10664
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10664
                                                                                                                                                                                                 | 
                                                             		$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10665
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10665
                                                                                                                                                                                                 | 
                                                             		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10666
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10666
                                                                                                                                                                                                 | 
                                                             		//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10671,14 +10671,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10671
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10671
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10672
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10672
                                                                                                                                                                                                 | 
                                                             			// Use select2 selector  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10673
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10673
                                                                                                                                                                                                 | 
                                                             			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10674
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10674
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10675
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10675
                                                                                                                                                                                                 | 
                                                             				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10676
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10676
                                                                                                                                                                                                 | 
                                                             				$out .= $comboenhancement;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10677
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10677
                                                                                                                                                                                                 | 
                                                             				$morecss = 'minwidth200imp maxwidth500';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10678
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10678
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10679
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10679
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10680
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10680
                                                                                                                                                                                                 | 
                                                             			if (empty($option_only)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10681
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10681
                                                                                                                                                                                                 | 
                                                            +				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10682
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10682
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10683
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10683
                                                                                                                                                                                                 | 
                                                             			if (!empty($show_empty)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10684
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10684
                                                                                                                                                                                                 | 
                                                             				$out .= '<option value="0" class="optiongrey">';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10708,33 +10708,33 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10708
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10708
                                                                                                                                                                                                 | 
                                                             						if ($showproject == 'all') { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10709
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10709
                                                                                                                                                                                                 | 
                                                             							$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10710
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10710
                                                                                                                                                                                                 | 
                                                             							if ($obj->name) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10711
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$labeltoshow .= ' - ' . $obj->name; // Soc name  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10711
                                                                                                                                                                                                 | 
                                                            +								$labeltoshow .= ' - '.$obj->name; // Soc name  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10712
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10712
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10713
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10713
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10714
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10714
                                                                                                                                                                                                 | 
                                                             							$disabled = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10715
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10715
                                                                                                                                                                                                 | 
                                                             							if ($obj->fk_statut == Project::STATUS_DRAFT) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10716
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10716
                                                                                                                                                                                                 | 
                                                             								$disabled = 1;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10717
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$labeltoshow .= ' - ' . $langs->trans("Draft"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10717
                                                                                                                                                                                                 | 
                                                            +								$labeltoshow .= ' - '.$langs->trans("Draft"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10718
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10718
                                                                                                                                                                                                 | 
                                                             							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10719
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10719
                                                                                                                                                                                                 | 
                                                             								if ($discard_closed == 2) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10720
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10720
                                                                                                                                                                                                 | 
                                                             									$disabled = 1;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10721
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10721
                                                                                                                                                                                                 | 
                                                             								}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10722
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$labeltoshow .= ' - ' . $langs->trans("Closed"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10722
                                                                                                                                                                                                 | 
                                                            +								$labeltoshow .= ' - '.$langs->trans("Closed"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10723
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10723
                                                                                                                                                                                                 | 
                                                             							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10724
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10724
                                                                                                                                                                                                 | 
                                                             								$disabled = 1;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10725
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10725
                                                                                                                                                                                                 | 
                                                            +								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10726
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10726
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10727
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10727
                                                                                                                                                                                                 | 
                                                             						}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10728
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10728
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10729
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10729
                                                                                                                                                                                                 | 
                                                             						if (!empty($selected) && $selected == $obj->rowid) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10730
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$out .= '<option value="' . $obj->rowid . '" selected';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10730
                                                                                                                                                                                                 | 
                                                            +							$out .= '<option value="'.$obj->rowid.'" selected';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10731
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10731
                                                                                                                                                                                                 | 
                                                             							//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10732
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$out .= '>' . $labeltoshow . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10732
                                                                                                                                                                                                 | 
                                                            +							$out .= '>'.$labeltoshow.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10733
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10733
                                                                                                                                                                                                 | 
                                                             						} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10734
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10734
                                                                                                                                                                                                 | 
                                                             							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10735
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10735
                                                                                                                                                                                                 | 
                                                             								$resultat = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10736
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10736
                                                                                                                                                                                                 | 
                                                             							} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10737
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -								$resultat = '<option value="' . $obj->rowid . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10737
                                                                                                                                                                                                 | 
                                                            +								$resultat = '<option value="'.$obj->rowid.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10738
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10738
                                                                                                                                                                                                 | 
                                                             								if ($disabled) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10739
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10739
                                                                                                                                                                                                 | 
                                                             									$resultat .= ' disabled';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10740
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10740
                                                                                                                                                                                                 | 
                                                             								}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10786,22 +10786,22 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10786
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10786
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10787
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10787
                                                                                                                                                                                                 | 
                                                             		$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10788
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10788
                                                                                                                                                                                                 | 
                                                             		//$sql.= ', el.fk_source';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10789
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10790
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10789
                                                                                                                                                                                                 | 
                                                            +		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10790
                                                                                                                                                                                                 | 
                                                            +		$sql .= " WHERE f.entity IN (".getEntity('invoice').")"; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10791
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10791
                                                                                                                                                                                                 | 
                                                             		$sql .= " ORDER BY f.titre ASC";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10792
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10792
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10793
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10793
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10794
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10794
                                                                                                                                                                                                 | 
                                                             		if ($resql) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10795
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10795
                                                                                                                                                                                                 | 
                                                             			// Use select2 selector  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10796
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10796
                                                                                                                                                                                                 | 
                                                             			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10797
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10797
                                                                                                                                                                                                 | 
                                                            +				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10798
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10798
                                                                                                                                                                                                 | 
                                                             				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10799
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10799
                                                                                                                                                                                                 | 
                                                             				$out .= $comboenhancement;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10800
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10800
                                                                                                                                                                                                 | 
                                                             				$morecss = 'minwidth200imp maxwidth500';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10801
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10801
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10802
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10802
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10803
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10803
                                                                                                                                                                                                 | 
                                                             			if (empty($option_only)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10804
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10804
                                                                                                                                                                                                 | 
                                                            +				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10805
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10805
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10806
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10806
                                                                                                                                                                                                 | 
                                                             			if (!empty($show_empty)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10807
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10807
                                                                                                                                                                                                 | 
                                                             				$out .= '<option value="0" class="optiongrey">';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10820,19 +10820,19 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10820
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10820
                                                                                                                                                                                                 | 
                                                             					$disabled = 0;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10821
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10821
                                                                                                                                                                                                 | 
                                                             					if (!empty($obj->suspended)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10822
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10822
                                                                                                                                                                                                 | 
                                                             						$disabled = 1;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10823
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$labeltoshow .= ' - ' . $langs->trans("Closed"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10823
                                                                                                                                                                                                 | 
                                                            +						$labeltoshow .= ' - '.$langs->trans("Closed"); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10824
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10824
                                                                                                                                                                                                 | 
                                                             					}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10825
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10825
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10826
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10826
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10827
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10827
                                                                                                                                                                                                 | 
                                                             					if (!empty($selected) && $selected == $obj->rowid) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10828
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '<option value="' . $obj->rowid . '" selected';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10828
                                                                                                                                                                                                 | 
                                                            +						$out .= '<option value="'.$obj->rowid.'" selected';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10829
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10829
                                                                                                                                                                                                 | 
                                                             						//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10830
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -						$out .= '>' . $labeltoshow . '</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10830
                                                                                                                                                                                                 | 
                                                            +						$out .= '>'.$labeltoshow.'</option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10831
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10831
                                                                                                                                                                                                 | 
                                                             					} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10832
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10832
                                                                                                                                                                                                 | 
                                                             						if ($disabled && ($selected != $obj->rowid)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10833
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10833
                                                                                                                                                                                                 | 
                                                             							$resultat = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10834
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10834
                                                                                                                                                                                                 | 
                                                             						} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10835
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -							$resultat = '<option value="' . $obj->rowid . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10835
                                                                                                                                                                                                 | 
                                                            +							$resultat = '<option value="'.$obj->rowid.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10836
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10836
                                                                                                                                                                                                 | 
                                                             							if ($disabled) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10837
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10837
                                                                                                                                                                                                 | 
                                                             								$resultat .= ' disabled';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10838
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10838
                                                                                                                                                                                                 | 
                                                             							}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10872,14 +10872,14 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10872
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10872
                                                                                                                                                                                                 | 
                                                             		global $langs;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10873
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10873
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10874
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10874
                                                                                                                                                                                                 | 
                                                             		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with () | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10875
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$search_component_params_hidden = '(' . $search_component_params_hidden . ')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10875
                                                                                                                                                                                                 | 
                                                            +			$search_component_params_hidden = '('.$search_component_params_hidden.')'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10876
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10876
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10877
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10877
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10878
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10878
                                                                                                                                                                                                 | 
                                                             		$ret = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10879
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10879
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10880
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10880
                                                                                                                                                                                                 | 
                                                             		$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10881
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10881
                                                                                                                                                                                                 | 
                                                             		$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10882
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10882
                                                                                                                                                                                                 | 
                                                            +		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10883
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10883
                                                                                                                                                                                                 | 
                                                             		$ret .= '</a>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10884
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10884
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10885
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10885
                                                                                                                                                                                                 | 
                                                             		$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10923,29 +10923,29 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10923
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10923
                                                                                                                                                                                                 | 
                                                             			$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10924
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10924
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10925
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10925
                                                                                                                                                                                                 | 
                                                             		$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%')) -->";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10926
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10926
                                                                                                                                                                                                 | 
                                                            +		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10927
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10927
                                                                                                                                                                                                 | 
                                                             		// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10928
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10928
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10929
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10929
                                                                                                                                                                                                 | 
                                                             		// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10930
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10930
                                                                                                                                                                                                 | 
                                                             		foreach ($arrayofcriterias as $criteria) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10931
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10931
                                                                                                                                                                                                 | 
                                                             			foreach ($criteria as $criteriafamilykey => $criteriafamilyval) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10932
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10932
                                                                                                                                                                                                 | 
                                                            +				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10933
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10933
                                                                                                                                                                                                 | 
                                                             					continue;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10934
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10934
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10935
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10935
                                                                                                                                                                                                 | 
                                                             				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10936
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10936
                                                                                                                                                                                                 | 
                                                             					continue;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10937
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10937
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10938
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10938
                                                                                                                                                                                                 | 
                                                             				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10939
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10940
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10941
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10942
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10943
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10944
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10945
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10946
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10939
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10940
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10941
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10942
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10943
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10944
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10945
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10946
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10947
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10947
                                                                                                                                                                                                 | 
                                                             				} else { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10948
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10948
                                                                                                                                                                                                 | 
                                                            +					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10949
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10949
                                                                                                                                                                                                 | 
                                                             				}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10950
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10950
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10951
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10951
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -10953,7 +10953,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    10953
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10953
                                                                                                                                                                                                 | 
                                                             		$ret .= '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10954
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10954
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10955
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10955
                                                                                                                                                                                                 | 
                                                             		$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";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10956
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    10956
                                                                                                                                                                                                 | 
                                                            +		$ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10957
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10957
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10958
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10958
                                                                                                                                                                                                 | 
                                                             		$ret .= '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    10959
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    10959
                                                                                                                                                                                                 | 
                                                             		$ret .= '</div>';  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -11027,7 +11027,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    11027
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11027
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11028
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11028
                                                                                                                                                                                                 | 
                                                             		$TModels = array();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11029
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11029
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11030
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11030
                                                                                                                                                                                                 | 
                                                            +		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11031
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11031
                                                                                                                                                                                                 | 
                                                             		$formmail = new FormMail($this->db);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11032
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11032
                                                                                                                                                                                                 | 
                                                             		$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11033
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11033
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -11040,17 +11040,17 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    11040
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11040
                                                                                                                                                                                                 | 
                                                             			}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11041
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11041
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11042
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11042
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11043
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11043
                                                                                                                                                                                                 | 
                                                            +		$retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11044
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11044
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11045
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11045
                                                                                                                                                                                                 | 
                                                             		foreach ($TModels as $id_model => $label_model) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11046
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= '<option value="' . $id_model . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11047
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= ">" . $label_model . "</option>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11046
                                                                                                                                                                                                 | 
                                                            +			$retstring .= '<option value="'.$id_model.'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11047
                                                                                                                                                                                                 | 
                                                            +			$retstring .= ">".$label_model."</option>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11048
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11048
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11049
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11049
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11050
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11050
                                                                                                                                                                                                 | 
                                                             		$retstring .= "</select>";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11051
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11051
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11052
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11052
                                                                                                                                                                                                 | 
                                                             		if ($addjscombo) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11053
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11053
                                                                                                                                                                                                 | 
                                                            +			$retstring .= ajax_combobox('select_'.$prefix.'model_mail'); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11054
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11054
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11055
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11055
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11056
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11056
                                                                                                                                                                                                 | 
                                                             		return $retstring;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -11101,16 +11101,16 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    11101
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11101
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11102
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11102
                                                                                                                                                                                                 | 
                                                             		foreach ($buttons as $button) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11103
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11103
                                                                                                                                                                                                 | 
                                                             			$addclass = empty($button['addclass']) ? '' : $button['addclass'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11104
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11104
                                                                                                                                                                                                 | 
                                                            +			$retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11105
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11105
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11106
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11106
                                                                                                                                                                                                 | 
                                                             		$retstring .= $withoutdiv ? '' : '</div>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11107
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11107
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11108
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11108
                                                                                                                                                                                                 | 
                                                             		if ($dol_openinpopup) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11109
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . $dol_openinpopup . ' context, so we enable the close of dialog on cancel -->' . "\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11110
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$retstring .= '<script nonce="' . getNonce() . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11109
                                                                                                                                                                                                 | 
                                                            +			$retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11110
                                                                                                                                                                                                 | 
                                                            +			$retstring .= '<script nonce="'.getNonce().'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11111
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11111
                                                                                                                                                                                                 | 
                                                             			$retstring .= 'jQuery(".button-cancel").click(function(e) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11112
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup . '\');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11113
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				window.parent.jQuery(\'#idfordialog' . $dol_openinpopup . '\').dialog(\'close\');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11112
                                                                                                                                                                                                 | 
                                                            +				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup.'\');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11113
                                                                                                                                                                                                 | 
                                                            +				window.parent.jQuery(\'#idfordialog' . $dol_openinpopup.'\').dialog(\'close\');  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11114
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11114
                                                                                                                                                                                                 | 
                                                             				 });';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11115
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11115
                                                                                                                                                                                                 | 
                                                             			$retstring .= '</script>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11116
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11116
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -11139,7 +11139,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    11139
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11139
                                                                                                                                                                                                 | 
                                                             		dol_syslog(__METHOD__, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11140
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11140
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11141
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11141
                                                                                                                                                                                                 | 
                                                             		$sql = "SELECT rowid, code, label as label";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11142
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11142
                                                                                                                                                                                                 | 
                                                            +		$sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11143
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11143
                                                                                                                                                                                                 | 
                                                             		$sql .= " WHERE active = 1";  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11144
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11144
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11145
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11145
                                                                                                                                                                                                 | 
                                                             		$resql = $this->db->query($sql);  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -11150,7 +11150,7 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    11150
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11150
                                                                                                                                                                                                 | 
                                                             				$obj = $this->db->fetch_object($resql);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11151
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11151
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11152
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11152
                                                                                                                                                                                                 | 
                                                             				// If translation exists, we use it, otherwise we take the default wording  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11153
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -				$label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11153
                                                                                                                                                                                                 | 
                                                            +				$label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11154
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11154
                                                                                                                                                                                                 | 
                                                             				$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11155
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11155
                                                                                                                                                                                                 | 
                                                             				$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11156
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11156
                                                                                                                                                                                                 | 
                                                             				$this->cache_invoice_subtype[$obj->rowid]['label'] = $label;  | 
                                                        
                                                                                                                                                        
                                                         | 
                                                        @@ -11182,18 +11182,18 @@  discard block  | 
                                                    
                                                    
                                                         | 
                                                         | 
                                                         block discarded – undo  | 
                                                    
                                                                                                                                                                                                                    
                                                            | 
                                                                                                                                    11182
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11182
                                                                                                                                                                                                 | 
                                                             		global $langs, $user;  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11183
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11183
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11184
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11184
                                                                                                                                                                                                 | 
                                                             		$out = '';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11185
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11185
                                                                                                                                                                                                 | 
                                                            +		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11186
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11186
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11187
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11187
                                                                                                                                                                                                 | 
                                                             		$this->load_cache_invoice_subtype();  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11188
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11188
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11189
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -		$out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11189
                                                                                                                                                                                                 | 
                                                            +		$out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11190
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11190
                                                                                                                                                                                                 | 
                                                             		if ($addempty) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11191
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11191
                                                                                                                                                                                                 | 
                                                             			$out .= '<option value="0"> </option>';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11192
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11192
                                                                                                                                                                                                 | 
                                                             		}  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11193
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11193
                                                                                                                                                                                                 | 
                                                               | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11194
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11194
                                                                                                                                                                                                 | 
                                                             		foreach ($this->cache_invoice_subtype as $rowid => $subtype) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11195
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11195
                                                                                                                                                                                                 | 
                                                             			$label = $subtype['label'];  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11196
                                                                                                                                                                                                 | 
                                                            
                                                                                                                             | 
                                                            -			$out .= '<option value="' . $subtype['rowid'] . '"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                             | 
                                                            
                                                                                                                                    11196
                                                                                                                                                                                                 | 
                                                            +			$out .= '<option value="'.$subtype['rowid'].'"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11197
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11197
                                                                                                                                                                                                 | 
                                                             			if ($selected == $subtype['rowid']) { | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11198
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11198
                                                                                                                                                                                                 | 
                                                             				$out .= ' selected="selected"';  | 
                                                        
                                                                                                            
                                                            | 
                                                                                                                                    11199
                                                                                                                                                                                                 | 
                                                            
                                                                                                                                    11199
                                                                                                                                                                                                 | 
                                                             			}  |