@@ -18,8 +18,8 @@ discard block  | 
                                                    ||
| 18 | 18 | |
| 19 | 19 | use Luracast\Restler\RestException;  | 
                                                        
| 20 | 20 | |
| 21 | -require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';  | 
                                                        |
| 22 | -require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';  | 
                                                        |
| 21 | +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';  | 
                                                        |
| 22 | +require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';  | 
                                                        |
| 23 | 23 | |
| 24 | 24 | /**  | 
                                                        
| 25 | 25 | * API class for supplier invoices  | 
                                                        
@@ -71,7 +71,7 @@ discard block  | 
                                                    ||
| 71 | 71 | }  | 
                                                        
| 72 | 72 | |
| 73 | 73 |  		if (!DolibarrApi::_checkAccessToResource('fournisseur', $id, 'facture_fourn', 'facture')) { | 
                                                        
| 74 | - throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);  | 
                                                        |
| 74 | + throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);  | 
                                                        |
| 75 | 75 | }  | 
                                                        
| 76 | 76 | |
| 77 | 77 | $result = $this->invoice->fetch($id);  | 
                                                        
@@ -118,11 +118,11 @@ discard block  | 
                                                    ||
| 118 | 118 | }  | 
                                                        
| 119 | 119 | |
| 120 | 120 | $sql = "SELECT t.rowid";  | 
                                                        
| 121 | - $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn AS t";  | 
                                                        |
| 122 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields  | 
                                                        |
| 123 | -		$sql .= ' WHERE t.entity IN (' . getEntity('supplier_invoice') . ')'; | 
                                                        |
| 121 | + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn AS t";  | 
                                                        |
| 122 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields  | 
                                                        |
| 123 | +		$sql .= ' WHERE t.entity IN ('.getEntity('supplier_invoice').')'; | 
                                                        |
| 124 | 124 |  		if ($socids) { | 
                                                        
| 125 | -			$sql .= " AND t.fk_soc IN (" . $this->db->sanitize($socids) . ")"; | 
                                                        |
| 125 | +			$sql .= " AND t.fk_soc IN (".$this->db->sanitize($socids).")"; | 
                                                        |
| 126 | 126 | }  | 
                                                        
| 127 | 127 | // Filter by status  | 
                                                        
| 128 | 128 |  		if ($status == 'draft') { | 
                                                        
@@ -150,7 +150,7 @@ discard block  | 
                                                    ||
| 150 | 150 | $errormessage = '';  | 
                                                        
| 151 | 151 | $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);  | 
                                                        
| 152 | 152 |  			if ($errormessage) { | 
                                                        
| 153 | - throw new RestException(400, 'Error when validating parameter sqlfilters -> ' . $errormessage);  | 
                                                        |
| 153 | + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);  | 
                                                        |
| 154 | 154 | }  | 
                                                        
| 155 | 155 | }  | 
                                                        
| 156 | 156 | |
@@ -178,7 +178,7 @@ discard block  | 
                                                    ||
| 178 | 178 | $i++;  | 
                                                        
| 179 | 179 | }  | 
                                                        
| 180 | 180 |  		} else { | 
                                                        
| 181 | - throw new RestException(503, 'Error when retrieve supplier invoice list : ' . $this->db->lasterror());  | 
                                                        |
| 181 | + throw new RestException(503, 'Error when retrieve supplier invoice list : '.$this->db->lasterror());  | 
                                                        |
| 182 | 182 | }  | 
                                                        
| 183 | 183 | |
| 184 | 184 | return $obj_ret;  | 
                                                        
@@ -243,7 +243,7 @@ discard block  | 
                                                    ||
| 243 | 243 | }  | 
                                                        
| 244 | 244 | |
| 245 | 245 |  		if (!DolibarrApi::_checkAccessToResource('fournisseur', $id, 'facture_fourn', 'facture')) { | 
                                                        
| 246 | - throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);  | 
                                                        |
| 246 | + throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);  | 
                                                        |
| 247 | 247 | }  | 
                                                        
| 248 | 248 | |
| 249 | 249 | $result = $this->invoice->fetch($id);  | 
                                                        
@@ -288,7 +288,7 @@ discard block  | 
                                                    ||
| 288 | 288 | throw new RestException(403);  | 
                                                        
| 289 | 289 | }  | 
                                                        
| 290 | 290 |  		if (!DolibarrApi::_checkAccessToResource('fournisseur', $id, 'facture_fourn', 'facture')) { | 
                                                        
| 291 | - throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);  | 
                                                        |
| 291 | + throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);  | 
                                                        |
| 292 | 292 | }  | 
                                                        
| 293 | 293 | $result = $this->invoice->fetch($id);  | 
                                                        
| 294 | 294 |  		if (!$result) { | 
                                                        
@@ -331,7 +331,7 @@ discard block  | 
                                                    ||
| 331 | 331 | }  | 
                                                        
| 332 | 332 | |
| 333 | 333 |  		if (!DolibarrApi::_checkAccessToResource('fournisseur', $id, 'facture_fourn', 'facture')) { | 
                                                        
| 334 | - throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);  | 
                                                        |
| 334 | + throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);  | 
                                                        |
| 335 | 335 | }  | 
                                                        
| 336 | 336 | |
| 337 | 337 | $result = $this->invoice->fetch($id);  | 
                                                        
@@ -344,13 +344,13 @@ discard block  | 
                                                    ||
| 344 | 344 | throw new RestException(304, 'Error nothing done. The invoice is already validated');  | 
                                                        
| 345 | 345 | }  | 
                                                        
| 346 | 346 |  		if ($result < 0) { | 
                                                        
| 347 | - throw new RestException(500, 'Error when validating Invoice: ' . $this->invoice->error);  | 
                                                        |
| 347 | + throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);  | 
                                                        |
| 348 | 348 | }  | 
                                                        
| 349 | 349 | |
| 350 | 350 | return array(  | 
                                                        
| 351 | 351 | 'success' => array(  | 
                                                        
| 352 | 352 | 'code' => 200,  | 
                                                        
| 353 | - 'message' => 'Invoice validated (Ref=' . $this->invoice->ref . ')'  | 
                                                        |
| 353 | + 'message' => 'Invoice validated (Ref='.$this->invoice->ref.')'  | 
                                                        |
| 354 | 354 | )  | 
                                                        
| 355 | 355 | );  | 
                                                        
| 356 | 356 | }  | 
                                                        
@@ -427,7 +427,7 @@ discard block  | 
                                                    ||
| 427 | 427 | throw new RestException(403);  | 
                                                        
| 428 | 428 | }  | 
                                                        
| 429 | 429 |  		if (!DolibarrApi::_checkAccessToResource('fournisseur', $id, 'facture_fourn', 'facture')) { | 
                                                        
| 430 | - throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);  | 
                                                        |
| 430 | + throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);  | 
                                                        |
| 431 | 431 | }  | 
                                                        
| 432 | 432 | |
| 433 | 433 | $result = $this->invoice->fetch($id);  | 
                                                        
@@ -481,14 +481,14 @@ discard block  | 
                                                    ||
| 481 | 481 | $paiement_id = $paiement->create(DolibarrApiAccess::$user, ($closepaidinvoices == 'yes' ? 1 : 0)); // This include closing invoices  | 
                                                        
| 482 | 482 |  		if ($paiement_id < 0) { | 
                                                        
| 483 | 483 | $this->db->rollback();  | 
                                                        
| 484 | - throw new RestException(400, 'Payment error : ' . $paiement->error);  | 
                                                        |
| 484 | + throw new RestException(400, 'Payment error : '.$paiement->error);  | 
                                                        |
| 485 | 485 | }  | 
                                                        
| 486 | 486 | |
| 487 | 487 |  		if (isModEnabled("banque")) { | 
                                                        
| 488 | 488 | $result = $paiement->addPaymentToBank(DolibarrApiAccess::$user, 'payment_supplier', '(SupplierInvoicePayment)', $accountid, $chqemetteur, $chqbank);  | 
                                                        
| 489 | 489 |  			if ($result < 0) { | 
                                                        
| 490 | 490 | $this->db->rollback();  | 
                                                        
| 491 | - throw new RestException(400, 'Add payment to bank error : ' . $paiement->error);  | 
                                                        |
| 491 | + throw new RestException(400, 'Add payment to bank error : '.$paiement->error);  | 
                                                        |
| 492 | 492 | }  | 
                                                        
| 493 | 493 | }  | 
                                                        
| 494 | 494 | |
@@ -515,7 +515,7 @@ discard block  | 
                                                    ||
| 515 | 515 | throw new RestException(403);  | 
                                                        
| 516 | 516 | }  | 
                                                        
| 517 | 517 |  		if (!DolibarrApi::_checkAccessToResource('fournisseur', $id, 'facture_fourn', 'facture')) { | 
                                                        
| 518 | - throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);  | 
                                                        |
| 518 | + throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);  | 
                                                        |
| 519 | 519 | }  | 
                                                        
| 520 | 520 | |
| 521 | 521 | $result = $this->invoice->fetch($id);  | 
                                                        
@@ -555,7 +555,7 @@ discard block  | 
                                                    ||
| 555 | 555 | }  | 
                                                        
| 556 | 556 | |
| 557 | 557 |  		if (!DolibarrApi::_checkAccessToResource('fournisseur', $id, 'facture_fourn', 'facture')) { | 
                                                        
| 558 | - throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);  | 
                                                        |
| 558 | + throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);  | 
                                                        |
| 559 | 559 | }  | 
                                                        
| 560 | 560 | |
| 561 | 561 | $result = $this->invoice->fetch($id);  | 
                                                        
@@ -594,7 +594,7 @@ discard block  | 
                                                    ||
| 594 | 594 | );  | 
                                                        
| 595 | 595 | |
| 596 | 596 |  		if ($updateRes < 0) { | 
                                                        
| 597 | - throw new RestException(400, 'Unable to insert the new line. Check your inputs. ' . $this->invoice->error);  | 
                                                        |
| 597 | + throw new RestException(400, 'Unable to insert the new line. Check your inputs. '.$this->invoice->error);  | 
                                                        |
| 598 | 598 | }  | 
                                                        
| 599 | 599 | |
| 600 | 600 | return $updateRes;  | 
                                                        
@@ -622,7 +622,7 @@ discard block  | 
                                                    ||
| 622 | 622 | }  | 
                                                        
| 623 | 623 | |
| 624 | 624 |  		if (!DolibarrApi::_checkAccessToResource('fournisseur', $id, 'facture_fourn', 'facture')) { | 
                                                        
| 625 | - throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);  | 
                                                        |
| 625 | + throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);  | 
                                                        |
| 626 | 626 | }  | 
                                                        
| 627 | 627 | |
| 628 | 628 | $result = $this->invoice->fetch($id);  | 
                                                        
@@ -692,7 +692,7 @@ discard block  | 
                                                    ||
| 692 | 692 | throw new RestException(403);  | 
                                                        
| 693 | 693 | }  | 
                                                        
| 694 | 694 |  		if (!DolibarrApi::_checkAccessToResource('fournisseur', $id, 'facture_fourn', 'facture')) { | 
                                                        
| 695 | - throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);  | 
                                                        |
| 695 | + throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);  | 
                                                        |
| 696 | 696 | }  | 
                                                        
| 697 | 697 | |
| 698 | 698 | $result = $this->invoice->fetch($id);  | 
                                                        
@@ -119,7 +119,7 @@ discard block  | 
                                                    ||
| 119 | 119 |  		if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) { | 
                                                        
| 120 | 120 |  			if (!empty($perm)) { | 
                                                        
| 121 | 121 |  				$tmp = explode(':', $typeofdata); | 
                                                        
| 122 | - $ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">';  | 
                                                        |
| 122 | + $ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';  | 
                                                        |
| 123 | 123 |  				if ($fieldrequired) { | 
                                                        
| 124 | 124 | $ret .= '<span class="fieldrequired">';  | 
                                                        
| 125 | 125 | }  | 
                                                        
@@ -131,7 +131,7 @@ discard block  | 
                                                    ||
| 131 | 131 |  				if ($fieldrequired) { | 
                                                        
| 132 | 132 | $ret .= '</span>';  | 
                                                        
| 133 | 133 | }  | 
                                                        
| 134 | - $ret .= '</div>' . "\n";  | 
                                                        |
| 134 | + $ret .= '</div>'."\n";  | 
                                                        |
| 135 | 135 |  			} else { | 
                                                        
| 136 | 136 |  				if ($fieldrequired) { | 
                                                        
| 137 | 137 | $ret .= '<span class="fieldrequired">';  | 
                                                        
@@ -169,8 +169,8 @@ discard block  | 
                                                    ||
| 169 | 169 |  			if (empty($notabletag) && $perm) { | 
                                                        
| 170 | 170 | $ret .= '<td class="right">';  | 
                                                        
| 171 | 171 | }  | 
                                                        
| 172 | -			if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { | 
                                                        |
| 173 | -				$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>'; | 
                                                        |
| 172 | +			if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { | 
                                                        |
| 173 | +				$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>'; | 
                                                        |
| 174 | 174 | }  | 
                                                        
| 175 | 175 |  			if (!empty($notabletag) && $notabletag == 1) { | 
                                                        
| 176 | 176 |  				if ($text) { | 
                                                        
@@ -237,7 +237,7 @@ discard block  | 
                                                    ||
| 237 | 237 |  			} elseif ($reg[1] == 'int') { | 
                                                        
| 238 | 238 | $typeofdata = 'numeric';  | 
                                                        
| 239 | 239 |  			} else { | 
                                                        
| 240 | - return 'ErrorBadParameter ' . $typeofdata;  | 
                                                        |
| 240 | + return 'ErrorBadParameter '.$typeofdata;  | 
                                                        |
| 241 | 241 | }  | 
                                                        
| 242 | 242 | }  | 
                                                        
| 243 | 243 | |
@@ -248,13 +248,13 @@ discard block  | 
                                                    ||
| 248 | 248 |  			if ($editaction == '') { | 
                                                        
| 249 | 249 |  				$editaction = GETPOST('action', 'aZ09'); | 
                                                        
| 250 | 250 | }  | 
                                                        
| 251 | - $editmode = ($editaction == 'edit' . $htmlname);  | 
                                                        |
| 251 | + $editmode = ($editaction == 'edit'.$htmlname);  | 
                                                        |
| 252 | 252 |  			if ($editmode) {	// edit mode | 
                                                        
| 253 | 253 | $ret .= "\n";  | 
                                                        
| 254 | - $ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">';  | 
                                                        |
| 255 | - $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';  | 
                                                        |
| 256 | - $ret .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 257 | - $ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">';  | 
                                                        |
| 254 | + $ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';  | 
                                                        |
| 255 | + $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';  | 
                                                        |
| 256 | + $ret .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 257 | + $ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';  | 
                                                        |
| 258 | 258 |  				if (empty($notabletag)) { | 
                                                        
| 259 | 259 | $ret .= '<table class="nobordernopadding centpercent">';  | 
                                                        
| 260 | 260 | }  | 
                                                        
@@ -263,28 +263,28 @@ discard block  | 
                                                    ||
| 263 | 263 | }  | 
                                                        
| 264 | 264 |  				if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) { | 
                                                        
| 265 | 265 |  					$tmp = explode(':', $typeofdata); | 
                                                        
| 266 | - $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';  | 
                                                        |
| 266 | + $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';  | 
                                                        |
| 267 | 267 |  				} elseif (preg_match('/^(integer)/', $typeofdata)) { | 
                                                        
| 268 | 268 |  					$tmp = explode(':', $typeofdata); | 
                                                        
| 269 | 269 | $valuetoshow = price2num($editvalue ? $editvalue : $value, 0);  | 
                                                        
| 270 | - $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';  | 
                                                        |
| 270 | + $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';  | 
                                                        |
| 271 | 271 |  				} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) { | 
                                                        
| 272 | 272 |  					$tmp = explode(':', $typeofdata); | 
                                                        
| 273 | 273 | $valuetoshow = price2num($editvalue ? $editvalue : $value);  | 
                                                        
| 274 | - $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';  | 
                                                        |
| 274 | + $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';  | 
                                                        |
| 275 | 275 |  				} elseif (preg_match('/^(checkbox)/', $typeofdata)) { | 
                                                        
| 276 | 276 |  					$tmp = explode(':', $typeofdata); | 
                                                        
| 277 | - $ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';  | 
                                                        |
| 277 | + $ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>';  | 
                                                        |
| 278 | 278 |  				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {    // if wysiwyg is enabled $typeofdata = 'ckeditor' | 
                                                        
| 279 | 279 |  					$tmp = explode(':', $typeofdata); | 
                                                        
| 280 | 280 | $cols = (empty($tmp[2]) ? '' : $tmp[2]);  | 
                                                        
| 281 | 281 | $morealt = '';  | 
                                                        
| 282 | 282 |  					if (preg_match('/%/', $cols)) { | 
                                                        
| 283 | - $morealt = ' style="width: ' . $cols . '"';  | 
                                                        |
| 283 | + $morealt = ' style="width: '.$cols.'"';  | 
                                                        |
| 284 | 284 | $cols = '';  | 
                                                        
| 285 | 285 | }  | 
                                                        
| 286 | 286 | $valuetoshow = ($editvalue ? $editvalue : $value);  | 
                                                        
| 287 | - $ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>';  | 
                                                        |
| 287 | + $ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>';  | 
                                                        |
| 288 | 288 | // textarea convert automatically entities chars into simple chars.  | 
                                                        
| 289 | 289 |  					// 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 wysiwig is off. | 
                                                        
| 290 | 290 |  					$valuetoshow = str_replace('&', '&', $valuetoshow); | 
                                                        
@@ -294,12 +294,12 @@ discard block  | 
                                                    ||
| 294 | 294 | $addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];  | 
                                                        
| 295 | 295 | $adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];  | 
                                                        
| 296 | 296 | $labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];  | 
                                                        
| 297 | - $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);  | 
                                                        |
| 297 | + $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);  | 
                                                        |
| 298 | 298 |  				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { | 
                                                        
| 299 | 299 | $addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];  | 
                                                        
| 300 | 300 | $adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];  | 
                                                        
| 301 | 301 | $labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];  | 
                                                        
| 302 | - $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);  | 
                                                        |
| 302 | + $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);  | 
                                                        |
| 303 | 303 |  				} elseif (preg_match('/^select;/', $typeofdata)) { | 
                                                        
| 304 | 304 |  					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); | 
                                                        
| 305 | 305 | $arraylist = array();  | 
                                                        
@@ -313,7 +313,7 @@ discard block  | 
                                                    ||
| 313 | 313 | // TODO Not yet implemented. See code for extrafields  | 
                                                        
| 314 | 314 |  				} elseif (preg_match('/^ckeditor/', $typeofdata)) { | 
                                                        
| 315 | 315 |  					$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser | 
                                                        
| 316 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';  | 
                                                        |
| 316 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';  | 
                                                        |
| 317 | 317 | $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]));  | 
                                                        
| 318 | 318 | $ret .= $doleditor->Create(1);  | 
                                                        
| 319 | 319 |  				} elseif ($typeofdata == 'asis') { | 
                                                        
@@ -328,19 +328,19 @@ discard block  | 
                                                    ||
| 328 | 328 | $ret .= '<td>';  | 
                                                        
| 329 | 329 | }  | 
                                                        
| 330 | 330 | //else $ret.='<div class="clearboth"></div>';  | 
                                                        
| 331 | -				$ret .= '<input type="submit" class="smallpaddingimp button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 331 | +				$ret .= '<input type="submit" class="smallpaddingimp button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 332 | 332 |  				if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) { | 
                                                        
| 333 | - $ret .= '<br>' . "\n";  | 
                                                        |
| 333 | + $ret .= '<br>'."\n";  | 
                                                        |
| 334 | 334 | }  | 
                                                        
| 335 | -				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">'; | 
                                                        |
| 335 | +				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">'; | 
                                                        |
| 336 | 336 |  				if (empty($notabletag)) { | 
                                                        
| 337 | 337 | $ret .= '</td>';  | 
                                                        
| 338 | 338 | }  | 
                                                        
| 339 | 339 | |
| 340 | 340 |  				if (empty($notabletag)) { | 
                                                        
| 341 | - $ret .= '</tr></table>' . "\n";  | 
                                                        |
| 341 | + $ret .= '</tr></table>'."\n";  | 
                                                        |
| 342 | 342 | }  | 
                                                        
| 343 | - $ret .= '</form>' . "\n";  | 
                                                        |
| 343 | + $ret .= '</form>'."\n";  | 
                                                        |
| 344 | 344 |  			} else {		// view mode | 
                                                        
| 345 | 345 |  				if (preg_match('/^email/', $typeofdata)) { | 
                                                        
| 346 | 346 | $ret .= dol_print_email($value, 0, 0, 0, 0, 1);  | 
                                                        
@@ -352,15 +352,15 @@ discard block  | 
                                                    ||
| 352 | 352 | $ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : '');  | 
                                                        
| 353 | 353 |  				} elseif (preg_match('/^checkbox/', $typeofdata)) { | 
                                                        
| 354 | 354 |  					$tmp = explode(':', $typeofdata); | 
                                                        
| 355 | - $ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>';  | 
                                                        |
| 355 | + $ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>';  | 
                                                        |
| 356 | 356 |  				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { | 
                                                        
| 357 | 357 | $ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1));  | 
                                                        
| 358 | 358 |  				} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) {	// 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring' | 
                                                        
| 359 | 359 | $ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value));  | 
                                                        
| 360 | 360 |  				} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') { | 
                                                        
| 361 | - $ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>';  | 
                                                        |
| 361 | + $ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>';  | 
                                                        |
| 362 | 362 |  				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { | 
                                                        
| 363 | - $ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>';  | 
                                                        |
| 363 | + $ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>';  | 
                                                        |
| 364 | 364 |  				} elseif (preg_match('/^select;/', $typeofdata)) { | 
                                                        
| 365 | 365 |  					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); | 
                                                        
| 366 | 366 | $arraylist = array();  | 
                                                        
@@ -371,9 +371,9 @@ discard block  | 
                                                    ||
| 371 | 371 | $ret .= $arraylist[$value];  | 
                                                        
| 372 | 372 |  					if ($htmlname == 'fk_product_type') { | 
                                                        
| 373 | 373 |  						if ($value == 0) { | 
                                                        
| 374 | -							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; | 
                                                        |
| 374 | +							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; | 
                                                        |
| 375 | 375 |  						} else { | 
                                                        
| 376 | -							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; | 
                                                        |
| 376 | +							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; | 
                                                        |
| 377 | 377 | }  | 
                                                        
| 378 | 378 | }  | 
                                                        
| 379 | 379 |  				} elseif (preg_match('/^ckeditor/', $typeofdata)) { | 
                                                        
@@ -381,7 +381,7 @@ discard block  | 
                                                    ||
| 381 | 381 |  					if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { | 
                                                        
| 382 | 382 |  						$firstline = preg_replace('/<br>.*/', '', $tmpcontent); | 
                                                        
| 383 | 383 |  						$firstline = preg_replace('/[\n\r].*/', '', $firstline); | 
                                                        
| 384 | - $tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');  | 
                                                        |
| 384 | + $tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');  | 
                                                        |
| 385 | 385 | }  | 
                                                        
| 386 | 386 | // We don't use dol_escape_htmltag to get the html formatting active, but this need we must also  | 
                                                        
| 387 | 387 | // clean data from some dangerous html  | 
                                                        
@@ -390,7 +390,7 @@ discard block  | 
                                                    ||
| 390 | 390 |  					if (empty($moreoptions['valuealreadyhtmlescaped'])) { | 
                                                        
| 391 | 391 | $ret .= dol_escape_htmltag($value);  | 
                                                        
| 392 | 392 |  					} else { | 
                                                        
| 393 | - $ret .= $value; // $value must be already html escaped.  | 
                                                        |
| 393 | + $ret .= $value; // $value must be already html escaped.  | 
                                                        |
| 394 | 394 | }  | 
                                                        
| 395 | 395 | }  | 
                                                        
| 396 | 396 | |
@@ -428,7 +428,7 @@ discard block  | 
                                                    ||
| 428 | 428 | |
| 429 | 429 |  		if (is_array($arrayoflangcode) && count($arrayoflangcode)) { | 
                                                        
| 430 | 430 |  			if (!is_object($extralanguages)) { | 
                                                        
| 431 | - include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';  | 
                                                        |
| 431 | + include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';  | 
                                                        |
| 432 | 432 | $extralanguages = new ExtraLanguages($this->db);  | 
                                                        
| 433 | 433 | }  | 
                                                        
| 434 | 434 |  			$extralanguages->fetch_name_extralanguages('societe'); | 
                                                        
@@ -437,17 +437,17 @@ discard block  | 
                                                    ||
| 437 | 437 | return ''; // No extralang field to show  | 
                                                        
| 438 | 438 | }  | 
                                                        
| 439 | 439 | |
| 440 | - $result .= '<!-- Widget for translation -->' . "\n";  | 
                                                        |
| 441 | - $result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">';  | 
                                                        |
| 440 | + $result .= '<!-- Widget for translation -->'."\n";  | 
                                                        |
| 441 | + $result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">';  | 
                                                        |
| 442 | 442 |  			$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', false, 0, 0, '', 'fa-15 editfieldlang'); | 
                                                        
| 443 | 443 | $result .= $s;  | 
                                                        
| 444 | 444 | $result .= '</div>';  | 
                                                        
| 445 | 445 | |
| 446 | - $result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">';  | 
                                                        |
| 446 | + $result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">';  | 
                                                        |
| 447 | 447 | |
| 448 | 448 | $resultforextrlang = '';  | 
                                                        
| 449 | 449 |  			foreach ($arrayoflangcode as $langcode) { | 
                                                        
| 450 | -				$valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : ''; | 
                                                        |
| 450 | +				$valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : ''; | 
                                                        |
| 451 | 451 |  				if (empty($valuetoshow)) { | 
                                                        
| 452 | 452 | $object->fetchValuesForExtraLanguages();  | 
                                                        
| 453 | 453 | //var_dump($object->array_languages);  | 
                                                        
@@ -459,17 +459,17 @@ discard block  | 
                                                    ||
| 459 | 459 | |
| 460 | 460 | // TODO Use the showInputField() method of ExtraLanguages object  | 
                                                        
| 461 | 461 |  				if ($typeofdata == 'textarea') { | 
                                                        
| 462 | - $resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">';  | 
                                                        |
| 462 | + $resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';  | 
                                                        |
| 463 | 463 | $resultforextrlang .= $valuetoshow;  | 
                                                        
| 464 | 464 | $resultforextrlang .= '</textarea>';  | 
                                                        
| 465 | 465 |  				} else { | 
                                                        
| 466 | - $resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">';  | 
                                                        |
| 466 | + $resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">';  | 
                                                        |
| 467 | 467 | }  | 
                                                        
| 468 | 468 | }  | 
                                                        
| 469 | 469 | $result .= $resultforextrlang;  | 
                                                        
| 470 | 470 | |
| 471 | 471 | $result .= '</div>';  | 
                                                        
| 472 | -			$result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>'; | 
                                                        |
| 472 | +			$result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>'; | 
                                                        |
| 473 | 473 | }  | 
                                                        
| 474 | 474 | |
| 475 | 475 | return $result;  | 
                                                        
@@ -534,7 +534,7 @@ discard block  | 
                                                    ||
| 534 | 534 |  				if (!empty($tmp[2])) { | 
                                                        
| 535 | 535 | $savemethod = $tmp[2];  | 
                                                        
| 536 | 536 | }  | 
                                                        
| 537 | - $out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n";  | 
                                                        |
| 537 | + $out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n";  | 
                                                        |
| 538 | 538 |  			} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) { | 
                                                        
| 539 | 539 |  				$tmp = explode(':', $inputType); | 
                                                        
| 540 | 540 | $inputType = $tmp[0];  | 
                                                        
@@ -545,7 +545,7 @@ discard block  | 
                                                    ||
| 545 | 545 | $savemethod = $tmp[2];  | 
                                                        
| 546 | 546 | }  | 
                                                        
| 547 | 547 | |
| 548 | - $out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format  | 
                                                        |
| 548 | + $out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format  | 
                                                        |
| 549 | 549 |  			} elseif (preg_match('/^(select|autocomplete)/', $inputType)) { | 
                                                        
| 550 | 550 |  				$tmp = explode(':', $inputType); | 
                                                        
| 551 | 551 | $inputType = $tmp[0];  | 
                                                        
@@ -576,40 +576,40 @@ discard block  | 
                                                    ||
| 576 | 576 | }  | 
                                                        
| 577 | 577 | |
| 578 | 578 |  				if (isModEnabled('fckeditor')) { | 
                                                        
| 579 | - $out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n";  | 
                                                        |
| 579 | + $out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n";  | 
                                                        |
| 580 | 580 |  				} else { | 
                                                        
| 581 | 581 | $inputType = 'textarea';  | 
                                                        
| 582 | 582 | }  | 
                                                        
| 583 | 583 | }  | 
                                                        
| 584 | 584 | |
| 585 | - $out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n";  | 
                                                        |
| 586 | - $out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n";  | 
                                                        |
| 587 | - $out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n";  | 
                                                        |
| 588 | - $out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n";  | 
                                                        |
| 585 | + $out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n";  | 
                                                        |
| 586 | + $out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n";  | 
                                                        |
| 587 | + $out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n";  | 
                                                        |
| 588 | + $out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n";  | 
                                                        |
| 589 | 589 |  			if (!empty($savemethod)) { | 
                                                        
| 590 | - $out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n";  | 
                                                        |
| 590 | + $out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";  | 
                                                        |
| 591 | 591 | }  | 
                                                        
| 592 | 592 |  			if (!empty($ext_element)) { | 
                                                        
| 593 | - $out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n";  | 
                                                        |
| 593 | + $out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";  | 
                                                        |
| 594 | 594 | }  | 
                                                        
| 595 | 595 |  			if (!empty($custommsg)) { | 
                                                        
| 596 | 596 |  				if (is_array($custommsg)) { | 
                                                        
| 597 | 597 |  					if (!empty($custommsg['success'])) { | 
                                                        
| 598 | - $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n";  | 
                                                        |
| 598 | + $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n";  | 
                                                        |
| 599 | 599 | }  | 
                                                        
| 600 | 600 |  					if (!empty($custommsg['error'])) { | 
                                                        
| 601 | - $out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n";  | 
                                                        |
| 601 | + $out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n";  | 
                                                        |
| 602 | 602 | }  | 
                                                        
| 603 | 603 |  				} else { | 
                                                        
| 604 | - $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n";  | 
                                                        |
| 604 | + $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n";  | 
                                                        |
| 605 | 605 | }  | 
                                                        
| 606 | 606 | }  | 
                                                        
| 607 | 607 |  			if ($inputType == 'textarea') { | 
                                                        
| 608 | - $out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n";  | 
                                                        |
| 609 | - $out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n";  | 
                                                        |
| 608 | + $out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n";  | 
                                                        |
| 609 | + $out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n";  | 
                                                        |
| 610 | 610 | }  | 
                                                        
| 611 | - $out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n";  | 
                                                        |
| 612 | - $out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n";  | 
                                                        |
| 611 | + $out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n";  | 
                                                        |
| 612 | + $out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n";  | 
                                                        |
| 613 | 613 |  		} else { | 
                                                        
| 614 | 614 | $out = $value;  | 
                                                        
| 615 | 615 | }  | 
                                                        
@@ -638,12 +638,12 @@ discard block  | 
                                                    ||
| 638 | 638 | public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)  | 
                                                        
| 639 | 639 |  	{ | 
                                                        
| 640 | 640 |  		if ($incbefore) { | 
                                                        
| 641 | - $text = $incbefore . $text;  | 
                                                        |
| 641 | + $text = $incbefore.$text;  | 
                                                        |
| 642 | 642 | }  | 
                                                        
| 643 | 643 |  		if (!$htmltext) { | 
                                                        
| 644 | 644 | return $text;  | 
                                                        
| 645 | 645 | }  | 
                                                        
| 646 | - $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0  | 
                                                        |
| 646 | + $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0  | 
                                                        |
| 647 | 647 | |
| 648 | 648 | $tag = 'td';  | 
                                                        
| 649 | 649 |  		if ($notabs == 2) { | 
                                                        
@@ -657,11 +657,11 @@ discard block  | 
                                                    ||
| 657 | 657 | |
| 658 | 658 | $extrastyle = '';  | 
                                                        
| 659 | 659 |  		if ($direction < 0) { | 
                                                        
| 660 | - $extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');  | 
                                                        |
| 660 | + $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');  | 
                                                        |
| 661 | 661 | $extrastyle = 'padding: 0px; padding-left: 3px;';  | 
                                                        
| 662 | 662 | }  | 
                                                        
| 663 | 663 |  		if ($direction > 0) { | 
                                                        
| 664 | - $extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');  | 
                                                        |
| 664 | + $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');  | 
                                                        |
| 665 | 665 | $extrastyle = 'padding: 0px; padding-right: 3px;';  | 
                                                        
| 666 | 666 | }  | 
                                                        
| 667 | 667 | |
@@ -674,53 +674,53 @@ discard block  | 
                                                    ||
| 674 | 674 |  			$htmltext = str_replace('"', '"', $htmltext); | 
                                                        
| 675 | 675 |  		} else { | 
                                                        
| 676 | 676 | $classfortooltip = 'classfortooltiponclick';  | 
                                                        
| 677 | - $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>';  | 
                                                        |
| 677 | + $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>';  | 
                                                        |
| 678 | 678 | }  | 
                                                        
| 679 | 679 |  		if ($tooltipon == 2 || $tooltipon == 3) { | 
                                                        
| 680 | - $paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"';  | 
                                                        |
| 680 | + $paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"';  | 
                                                        |
| 681 | 681 |  			if ($tooltiptrigger == '') { | 
                                                        
| 682 | - $paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip  | 
                                                        |
| 682 | + $paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip  | 
                                                        |
| 683 | 683 |  			} else { | 
                                                        
| 684 | - $paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"';  | 
                                                        |
| 684 | + $paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"';  | 
                                                        |
| 685 | 685 | }  | 
                                                        
| 686 | 686 |  		} else { | 
                                                        
| 687 | - $paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag  | 
                                                        |
| 687 | + $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag  | 
                                                        |
| 688 | 688 | }  | 
                                                        
| 689 | 689 |  		if ($tooltipon == 1 || $tooltipon == 3) { | 
                                                        
| 690 | - $paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" ';  | 
                                                        |
| 690 | + $paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" ';  | 
                                                        |
| 691 | 691 |  			if ($tooltiptrigger == '') { | 
                                                        
| 692 | - $paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip  | 
                                                        |
| 692 | + $paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip  | 
                                                        |
| 693 | 693 |  			} else { | 
                                                        
| 694 | - $paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"';  | 
                                                        |
| 694 | + $paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"';  | 
                                                        |
| 695 | 695 | }  | 
                                                        
| 696 | 696 |  		} else { | 
                                                        
| 697 | - $paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag  | 
                                                        |
| 697 | + $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag  | 
                                                        |
| 698 | 698 | }  | 
                                                        
| 699 | 699 |  		if (empty($notabs)) { | 
                                                        
| 700 | 700 | $s .= '<table class="nobordernopadding"><tr style="height: auto;">';  | 
                                                        
| 701 | 701 |  		} elseif ($notabs == 2) { | 
                                                        
| 702 | - $s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">';  | 
                                                        |
| 702 | + $s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">';  | 
                                                        |
| 703 | 703 | }  | 
                                                        
| 704 | 704 | // Define value if value is before  | 
                                                        
| 705 | 705 |  		if ($direction < 0) { | 
                                                        
| 706 | - $s .= '<' . $tag . $paramfortooltipimg;  | 
                                                        |
| 706 | + $s .= '<'.$tag.$paramfortooltipimg;  | 
                                                        |
| 707 | 707 |  			if ($tag == 'td') { | 
                                                        
| 708 | 708 | $s .= ' class="valigntop" width="14"';  | 
                                                        
| 709 | 709 | }  | 
                                                        
| 710 | - $s .= '>' . $textfordialog . $img . '</' . $tag . '>';  | 
                                                        |
| 710 | + $s .= '>'.$textfordialog.$img.'</'.$tag.'>';  | 
                                                        |
| 711 | 711 | }  | 
                                                        
| 712 | 712 | // Use another method to help avoid having a space in value in order to use this value with jquery  | 
                                                        
| 713 | 713 | // Define label  | 
                                                        
| 714 | 714 |  		if ((string) $text != '') { | 
                                                        
| 715 | - $s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>';  | 
                                                        |
| 715 | + $s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';  | 
                                                        |
| 716 | 716 | }  | 
                                                        
| 717 | 717 | // Define value if value is after  | 
                                                        
| 718 | 718 |  		if ($direction > 0) { | 
                                                        
| 719 | - $s .= '<' . $tag . $paramfortooltipimg;  | 
                                                        |
| 719 | + $s .= '<'.$tag.$paramfortooltipimg;  | 
                                                        |
| 720 | 720 |  			if ($tag == 'td') { | 
                                                        
| 721 | 721 | $s .= ' class="valignmiddle" width="14"';  | 
                                                        
| 722 | 722 | }  | 
                                                        
| 723 | - $s .= '>' . $textfordialog . $img . '</' . $tag . '>';  | 
                                                        |
| 723 | + $s .= '>'.$textfordialog.$img.'</'.$tag.'>';  | 
                                                        |
| 724 | 724 | }  | 
                                                        
| 725 | 725 |  		if (empty($notabs)) { | 
                                                        
| 726 | 726 | $s .= '</tr></table>';  | 
                                                        
@@ -824,7 +824,7 @@ discard block  | 
                                                    ||
| 824 | 824 | |
| 825 | 825 | $disabled = 0;  | 
                                                        
| 826 | 826 | $ret = '<div class="centpercent center">';  | 
                                                        
| 827 | - $ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>';  | 
                                                        |
| 827 | + $ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>';  | 
                                                        |
| 828 | 828 | |
| 829 | 829 | // 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.  | 
                                                        
| 830 | 830 | $parameters = array();  | 
                                                        
@@ -834,9 +834,9 @@ discard block  | 
                                                    ||
| 834 | 834 | return;  | 
                                                        
| 835 | 835 | }  | 
                                                        
| 836 | 836 |  		if (empty($reshook)) { | 
                                                        
| 837 | -			$ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>'; | 
                                                        |
| 837 | +			$ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>'; | 
                                                        |
| 838 | 838 |  			foreach ($arrayofaction as $code => $label) { | 
                                                        
| 839 | - $ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>';  | 
                                                        |
| 839 | + $ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>';  | 
                                                        |
| 840 | 840 | }  | 
                                                        
| 841 | 841 | }  | 
                                                        
| 842 | 842 | $ret .= $hookmanager->resPrint;  | 
                                                        
@@ -844,17 +844,17 @@ discard block  | 
                                                    ||
| 844 | 844 | $ret .= '</select>';  | 
                                                        
| 845 | 845 | |
| 846 | 846 |  		if (empty($conf->dol_optimize_smallscreen)) { | 
                                                        
| 847 | -			$ret .= ajax_combobox('.' . $name . 'select'); | 
                                                        |
| 847 | +			$ret .= ajax_combobox('.'.$name.'select'); | 
                                                        |
| 848 | 848 | }  | 
                                                        
| 849 | 849 | |
| 850 | 850 | // 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  | 
                                                        
| 851 | 851 | $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.  | 
                                                        
| 852 | -		$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")) . '">'; | 
                                                        |
| 852 | +		$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")).'">'; | 
                                                        |
| 853 | 853 | $ret .= '</div>';  | 
                                                        
| 854 | 854 | |
| 855 | 855 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 856 | 856 | $ret .= '<!-- JS CODE TO ENABLE mass action select -->  | 
                                                        
| 857 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 857 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 858 | 858 | 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 */  | 
                                                        
| 859 | 859 |          		{ | 
                                                        
| 860 | 860 | atleastoneselected=0;  | 
                                                        
@@ -865,11 +865,11 @@ discard block  | 
                                                    ||
| 865 | 865 | |
| 866 | 866 |  					console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected); | 
                                                        
| 867 | 867 | |
| 868 | - if (atleastoneselected || ' . $alwaysvisible . ')  | 
                                                        |
| 868 | + if (atleastoneselected || ' . $alwaysvisible.')  | 
                                                        |
| 869 | 869 |      	  			{ | 
                                                        
| 870 | 870 |                                      jQuery("."+name).show(); | 
                                                        
| 871 | -        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . ' | 
                                                        |
| 872 | -        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . ' | 
                                                        |
| 871 | +        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').' | 
                                                        |
| 872 | +        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').' | 
                                                        |
| 873 | 873 | }  | 
                                                        
| 874 | 874 | else  | 
                                                        
| 875 | 875 |      	  			{ | 
                                                        
@@ -879,11 +879,11 @@ discard block  | 
                                                    ||
| 879 | 879 | }  | 
                                                        
| 880 | 880 | |
| 881 | 881 |          	jQuery(document).ready(function () { | 
                                                        
| 882 | - initCheckForSelect(0, "' . $name . '", "' . $cssclass . '");  | 
                                                        |
| 883 | -                    jQuery(".' . $cssclass . '").click(function() { | 
                                                        |
| 884 | - initCheckForSelect(1, "' . $name . '", "' . $cssclass . '");  | 
                                                        |
| 882 | + initCheckForSelect(0, "' . $name.'", "'.$cssclass.'");  | 
                                                        |
| 883 | +                    jQuery(".' . $cssclass.'").click(function() { | 
                                                        |
| 884 | + initCheckForSelect(1, "' . $name.'", "'.$cssclass.'");  | 
                                                        |
| 885 | 885 | });  | 
                                                        
| 886 | -                        jQuery(".' . $name . 'select").change(function() { | 
                                                        |
| 886 | +                        jQuery(".' . $name.'select").change(function() { | 
                                                        |
| 887 | 887 | var massaction = $( this ).val();  | 
                                                        
| 888 | 888 |          			var urlform = $( this ).closest("form").attr("action").replace("#show_files",""); | 
                                                        
| 889 | 889 | if (massaction == "builddoc")  | 
                                                        
@@ -891,18 +891,18 @@ discard block  | 
                                                    ||
| 891 | 891 | urlform = urlform + "#show_files";  | 
                                                        
| 892 | 892 | }  | 
                                                        
| 893 | 893 |          			$( this ).closest("form").attr("action", urlform); | 
                                                        
| 894 | -                    console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform); | 
                                                        |
| 894 | +                    console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform); | 
                                                        |
| 895 | 895 | /* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */  | 
                                                        
| 896 | 896 | if ($(this).val() != \'0\')  | 
                                                        
| 897 | 897 |      	  			{ | 
                                                        
| 898 | -                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', false); | 
                                                        |
| 899 | -										jQuery(".' . $name . 'other").hide();	/* To disable if another div was open */ | 
                                                        |
| 900 | -                                        jQuery(".' . $name . '"+massaction).show(); | 
                                                        |
| 898 | +                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', false); | 
                                                        |
| 899 | +										jQuery(".' . $name.'other").hide();	/* To disable if another div was open */ | 
                                                        |
| 900 | +                                        jQuery(".' . $name.'"+massaction).show(); | 
                                                        |
| 901 | 901 | }  | 
                                                        
| 902 | 902 | else  | 
                                                        
| 903 | 903 |      	  			{ | 
                                                        
| 904 | -                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', true); | 
                                                        |
| 905 | -										jQuery(".' . $name . 'other").hide();	/* To disable any div open */ | 
                                                        |
| 904 | +                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', true); | 
                                                        |
| 905 | +										jQuery(".' . $name.'other").hide();	/* To disable any div open */ | 
                                                        |
| 906 | 906 | }  | 
                                                        
| 907 | 907 | });  | 
                                                        
| 908 | 908 | });  | 
                                                        
@@ -945,14 +945,14 @@ discard block  | 
                                                    ||
| 945 | 945 | $atleastonefavorite = 0;  | 
                                                        
| 946 | 946 | |
| 947 | 947 | $sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec";  | 
                                                        
| 948 | - $sql .= " FROM " . $this->db->prefix() . "c_country";  | 
                                                        |
| 948 | + $sql .= " FROM ".$this->db->prefix()."c_country";  | 
                                                        |
| 949 | 949 | $sql .= " WHERE active > 0";  | 
                                                        
| 950 | 950 | //$sql.= " ORDER BY code ASC";  | 
                                                        
| 951 | 951 | |
| 952 | - dol_syslog(get_class($this) . "::select_country", LOG_DEBUG);  | 
                                                        |
| 952 | + dol_syslog(get_class($this)."::select_country", LOG_DEBUG);  | 
                                                        |
| 953 | 953 | $resql = $this->db->query($sql);  | 
                                                        
| 954 | 954 |  		if ($resql) { | 
                                                        
| 955 | - $out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>';  | 
                                                        |
| 955 | + $out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>';  | 
                                                        |
| 956 | 956 | $num = $this->db->num_rows($resql);  | 
                                                        
| 957 | 957 | $i = 0;  | 
                                                        
| 958 | 958 |  			if ($num) { | 
                                                        
@@ -962,7 +962,7 @@ discard block  | 
                                                    ||
| 962 | 962 | $countryArray[$i]['rowid'] = $obj->rowid;  | 
                                                        
| 963 | 963 | $countryArray[$i]['code_iso'] = $obj->code_iso;  | 
                                                        
| 964 | 964 | $countryArray[$i]['code_iso3'] = $obj->code_iso3;  | 
                                                        
| 965 | -					$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 : '')); | 
                                                        |
| 965 | +					$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 : '')); | 
                                                        |
| 966 | 966 | $countryArray[$i]['favorite'] = $obj->favorite;  | 
                                                        
| 967 | 967 | $countryArray[$i]['eec'] = $obj->eec;  | 
                                                        
| 968 | 968 | $favorite[$i] = $obj->favorite;  | 
                                                        
@@ -980,20 +980,20 @@ discard block  | 
                                                    ||
| 980 | 980 | |
| 981 | 981 |  				if ($showempty) { | 
                                                        
| 982 | 982 |  					if (is_numeric($showempty)) { | 
                                                        
| 983 | - $out .= '<option value=""> </option>' . "\n";  | 
                                                        |
| 983 | + $out .= '<option value=""> </option>'."\n";  | 
                                                        |
| 984 | 984 |  					} else { | 
                                                        
| 985 | - $out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n";  | 
                                                        |
| 985 | + $out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n";  | 
                                                        |
| 986 | 986 | }  | 
                                                        
| 987 | 987 | }  | 
                                                        
| 988 | 988 | |
| 989 | 989 |  				if ($addspecialentries) {    // Add dedicated entries for groups of countries | 
                                                        
| 990 | 990 | //if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';  | 
                                                        
| 991 | -					$out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; | 
                                                        |
| 992 | -					$out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>'; | 
                                                        |
| 991 | +					$out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; | 
                                                        |
| 992 | +					$out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>'; | 
                                                        |
| 993 | 993 |  					if ($mysoc->isInEEC()) { | 
                                                        
| 994 | -						$out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; | 
                                                        |
| 994 | +						$out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; | 
                                                        |
| 995 | 995 | }  | 
                                                        
| 996 | -					$out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>'; | 
                                                        |
| 996 | +					$out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>'; | 
                                                        |
| 997 | 997 | $out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>';  | 
                                                        
| 998 | 998 | }  | 
                                                        
| 999 | 999 | |
@@ -1021,20 +1021,20 @@ discard block  | 
                                                    ||
| 1021 | 1021 | $labeltoshow .= ' ';  | 
                                                        
| 1022 | 1022 | }  | 
                                                        
| 1023 | 1023 |  					if ($row['code_iso']) { | 
                                                        
| 1024 | -						$labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>'; | 
                                                        |
| 1024 | +						$labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>'; | 
                                                        |
| 1025 | 1025 |  						if (empty($hideflags)) { | 
                                                        
| 1026 | 1026 | $tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1);  | 
                                                        
| 1027 | - $labeltoshow = $tmpflag . ' ' . $labeltoshow;  | 
                                                        |
| 1027 | + $labeltoshow = $tmpflag.' '.$labeltoshow;  | 
                                                        |
| 1028 | 1028 | }  | 
                                                        
| 1029 | 1029 | }  | 
                                                        
| 1030 | 1030 | |
| 1031 | 1031 |  					if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) { | 
                                                        
| 1032 | - $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']) . '">';  | 
                                                        |
| 1032 | + $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']).'">';  | 
                                                        |
| 1033 | 1033 |  					} else { | 
                                                        
| 1034 | - $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']) . '">';  | 
                                                        |
| 1034 | + $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']).'">';  | 
                                                        |
| 1035 | 1035 | }  | 
                                                        
| 1036 | 1036 | $out .= $labeltoshow;  | 
                                                        
| 1037 | - $out .= '</option>' . "\n";  | 
                                                        |
| 1037 | + $out .= '</option>'."\n";  | 
                                                        |
| 1038 | 1038 | }  | 
                                                        
| 1039 | 1039 | }  | 
                                                        
| 1040 | 1040 | $out .= '</select>';  | 
                                                        
@@ -1043,8 +1043,8 @@ discard block  | 
                                                    ||
| 1043 | 1043 | }  | 
                                                        
| 1044 | 1044 | |
| 1045 | 1045 | // Make select dynamic  | 
                                                        
| 1046 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1047 | -		$out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve'); | 
                                                        |
| 1046 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1047 | +		$out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve'); | 
                                                        |
| 1048 | 1048 | |
| 1049 | 1049 | return $out;  | 
                                                        
| 1050 | 1050 | }  | 
                                                        
@@ -1076,25 +1076,25 @@ discard block  | 
                                                    ||
| 1076 | 1076 | $incotermArray = array();  | 
                                                        
| 1077 | 1077 | |
| 1078 | 1078 | $sql = "SELECT rowid, code";  | 
                                                        
| 1079 | - $sql .= " FROM " . $this->db->prefix() . "c_incoterms";  | 
                                                        |
| 1079 | + $sql .= " FROM ".$this->db->prefix()."c_incoterms";  | 
                                                        |
| 1080 | 1080 | $sql .= " WHERE active > 0";  | 
                                                        
| 1081 | 1081 | $sql .= " ORDER BY code ASC";  | 
                                                        
| 1082 | 1082 | |
| 1083 | - dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG);  | 
                                                        |
| 1083 | + dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);  | 
                                                        |
| 1084 | 1084 | $resql = $this->db->query($sql);  | 
                                                        
| 1085 | 1085 |  		if ($resql) { | 
                                                        
| 1086 | 1086 |  			if ($conf->use_javascript_ajax && !$forcecombo) { | 
                                                        
| 1087 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1087 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1088 | 1088 | $out .= ajax_combobox($htmlname, $events);  | 
                                                        
| 1089 | 1089 | }  | 
                                                        
| 1090 | 1090 | |
| 1091 | 1091 |  			if (!empty($page)) { | 
                                                        
| 1092 | - $out .= '<form method="post" action="' . $page . '">';  | 
                                                        |
| 1092 | + $out .= '<form method="post" action="'.$page.'">';  | 
                                                        |
| 1093 | 1093 | $out .= '<input type="hidden" name="action" value="set_incoterms">';  | 
                                                        
| 1094 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 1094 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 1095 | 1095 | }  | 
                                                        
| 1096 | 1096 | |
| 1097 | - $out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>';  | 
                                                        |
| 1097 | + $out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>';  | 
                                                        |
| 1098 | 1098 | $out .= '<option value="0"> </option>';  | 
                                                        
| 1099 | 1099 | $num = $this->db->num_rows($resql);  | 
                                                        
| 1100 | 1100 | $i = 0;  | 
                                                        
@@ -1108,9 +1108,9 @@ discard block  | 
                                                    ||
| 1108 | 1108 | |
| 1109 | 1109 |  				foreach ($incotermArray as $row) { | 
                                                        
| 1110 | 1110 |  					if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) { | 
                                                        
| 1111 | - $out .= '<option value="' . $row['rowid'] . '" selected>';  | 
                                                        |
| 1111 | + $out .= '<option value="'.$row['rowid'].'" selected>';  | 
                                                        |
| 1112 | 1112 |  					} else { | 
                                                        
| 1113 | - $out .= '<option value="' . $row['rowid'] . '">';  | 
                                                        |
| 1113 | + $out .= '<option value="'.$row['rowid'].'">';  | 
                                                        |
| 1114 | 1114 | }  | 
                                                        
| 1115 | 1115 | |
| 1116 | 1116 |  					if ($row['code']) { | 
                                                        
@@ -1123,13 +1123,13 @@ discard block  | 
                                                    ||
| 1123 | 1123 | $out .= '</select>';  | 
                                                        
| 1124 | 1124 | |
| 1125 | 1125 |  			if ($conf->use_javascript_ajax && empty($disableautocomplete)) { | 
                                                        
| 1126 | -				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n"; | 
                                                        |
| 1126 | +				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; | 
                                                        |
| 1127 | 1127 | $moreattrib .= ' autocomplete="off"';  | 
                                                        
| 1128 | 1128 | }  | 
                                                        
| 1129 | - $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n";  | 
                                                        |
| 1129 | + $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n";  | 
                                                        |
| 1130 | 1130 | |
| 1131 | 1131 |  			if (!empty($page)) { | 
                                                        
| 1132 | -				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>'; | 
                                                        |
| 1132 | +				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>'; | 
                                                        |
| 1133 | 1133 | }  | 
                                                        
| 1134 | 1134 |  		} else { | 
                                                        
| 1135 | 1135 | dol_print_error($this->db);  | 
                                                        
@@ -1160,9 +1160,9 @@ discard block  | 
                                                    ||
| 1160 | 1160 |  		if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service")) | 
                                                        
| 1161 | 1161 |  			|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) { | 
                                                        
| 1162 | 1162 |  			if (empty($hidetext)) { | 
                                                        
| 1163 | -				print $langs->trans("Type") . ': '; | 
                                                        |
| 1163 | +				print $langs->trans("Type").': '; | 
                                                        |
| 1164 | 1164 | }  | 
                                                        
| 1165 | - print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 1165 | + print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 1166 | 1166 |  			if ($showempty) { | 
                                                        
| 1167 | 1167 | print '<option value="-1"';  | 
                                                        
| 1168 | 1168 |  				if ($selected == -1) { | 
                                                        
@@ -1175,28 +1175,28 @@ discard block  | 
                                                    ||
| 1175 | 1175 |  			if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) { | 
                                                        
| 1176 | 1176 | print ' selected';  | 
                                                        
| 1177 | 1177 | }  | 
                                                        
| 1178 | -			print '>' . $langs->trans("Product"); | 
                                                        |
| 1178 | +			print '>'.$langs->trans("Product"); | 
                                                        |
| 1179 | 1179 | |
| 1180 | 1180 | print '<option value="1"';  | 
                                                        
| 1181 | 1181 |  			if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) { | 
                                                        
| 1182 | 1182 | print ' selected';  | 
                                                        
| 1183 | 1183 | }  | 
                                                        
| 1184 | -			print '>' . $langs->trans("Service"); | 
                                                        |
| 1184 | +			print '>'.$langs->trans("Service"); | 
                                                        |
| 1185 | 1185 | |
| 1186 | 1186 | print '</select>';  | 
                                                        
| 1187 | -			print ajax_combobox('select_' . $htmlname); | 
                                                        |
| 1187 | +			print ajax_combobox('select_'.$htmlname); | 
                                                        |
| 1188 | 1188 |  			//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); | 
                                                        
| 1189 | 1189 | }  | 
                                                        
| 1190 | 1190 |  		if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) { | 
                                                        
| 1191 | 1191 |  			print $langs->trans("Service"); | 
                                                        
| 1192 | - print '<input type="hidden" name="' . $htmlname . '" value="1">';  | 
                                                        |
| 1192 | + print '<input type="hidden" name="'.$htmlname.'" value="1">';  | 
                                                        |
| 1193 | 1193 | }  | 
                                                        
| 1194 | 1194 |  		if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) { | 
                                                        
| 1195 | 1195 |  			print $langs->trans("Product"); | 
                                                        
| 1196 | - print '<input type="hidden" name="' . $htmlname . '" value="0">';  | 
                                                        |
| 1196 | + print '<input type="hidden" name="'.$htmlname.'" value="0">';  | 
                                                        |
| 1197 | 1197 | }  | 
                                                        
| 1198 | 1198 |  		if ($forceall < 0) {    // This should happened only for contracts when both predefined product and service are disabled. | 
                                                        
| 1199 | - 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  | 
                                                        |
| 1199 | + 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  | 
                                                        |
| 1200 | 1200 | }  | 
                                                        
| 1201 | 1201 | }  | 
                                                        
| 1202 | 1202 | |
@@ -1222,7 +1222,7 @@ discard block  | 
                                                    ||
| 1222 | 1222 |  		$langs->load("trips"); | 
                                                        
| 1223 | 1223 | |
| 1224 | 1224 | $sql = "SELECT c.code, c.label";  | 
                                                        
| 1225 | - $sql .= " FROM " . $this->db->prefix() . "c_type_fees as c";  | 
                                                        |
| 1225 | + $sql .= " FROM ".$this->db->prefix()."c_type_fees as c";  | 
                                                        |
| 1226 | 1226 | $sql .= " WHERE active > 0";  | 
                                                        
| 1227 | 1227 | |
| 1228 | 1228 | $resql = $this->db->query($sql);  | 
                                                        
@@ -1263,11 +1263,11 @@ discard block  | 
                                                    ||
| 1263 | 1263 | // phpcs:enable  | 
                                                        
| 1264 | 1264 | global $user, $langs;  | 
                                                        
| 1265 | 1265 | |
| 1266 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 1266 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 1267 | 1267 | |
| 1268 | 1268 | $this->load_cache_types_fees();  | 
                                                        
| 1269 | 1269 | |
| 1270 | - print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">';  | 
                                                        |
| 1270 | + print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">';  | 
                                                        |
| 1271 | 1271 |  		if ($showempty) { | 
                                                        
| 1272 | 1272 | print '<option value="-1"';  | 
                                                        
| 1273 | 1273 |  			if ($selected == -1) { | 
                                                        
@@ -1277,7 +1277,7 @@ discard block  | 
                                                    ||
| 1277 | 1277 | }  | 
                                                        
| 1278 | 1278 | |
| 1279 | 1279 |  		foreach ($this->cache_types_fees as $key => $value) { | 
                                                        
| 1280 | - print '<option value="' . $key . '"';  | 
                                                        |
| 1280 | + print '<option value="'.$key.'"';  | 
                                                        |
| 1281 | 1281 |  			if ($key == $selected) { | 
                                                        
| 1282 | 1282 | print ' selected';  | 
                                                        
| 1283 | 1283 | }  | 
                                                        
@@ -1328,12 +1328,12 @@ discard block  | 
                                                    ||
| 1328 | 1328 | $ajaxoptions = array();  | 
                                                        
| 1329 | 1329 | }  | 
                                                        
| 1330 | 1330 | |
| 1331 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1331 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1332 | 1332 | |
| 1333 | 1333 | // No immediate load of all database  | 
                                                        
| 1334 | 1334 | $placeholder = '';  | 
                                                        
| 1335 | 1335 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 1336 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        |
| 1336 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        |
| 1337 | 1337 | $societetmp = new Societe($this->db);  | 
                                                        
| 1338 | 1338 | $societetmp->fetch($selected);  | 
                                                        
| 1339 | 1339 | $selected_input_value = $societetmp->name;  | 
                                                        
@@ -1341,25 +1341,25 @@ discard block  | 
                                                    ||
| 1341 | 1341 | }  | 
                                                        
| 1342 | 1342 | |
| 1343 | 1343 | // mode 1  | 
                                                        
| 1344 | -			$urloption = 'htmlname=' . urlencode(str_replace('.', '_', $htmlname)) . '&outjson=1&filter=' . urlencode($filter) . (empty($excludeids) ? '' : '&excludeids=' . join(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode($showtype) : '') . ($showcode ? '&showcode=' . urlencode($showcode) : ''); | 
                                                        |
| 1344 | +			$urloption = 'htmlname='.urlencode(str_replace('.', '_', $htmlname)).'&outjson=1&filter='.urlencode($filter).(empty($excludeids) ? '' : '&excludeids='.join(',', $excludeids)).($showtype ? '&showtype='.urlencode($showtype) : '').($showcode ? '&showcode='.urlencode($showcode) : ''); | 
                                                        |
| 1345 | 1345 | |
| 1346 | 1346 |  			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                        
| 1347 | 1347 |  			if (empty($hidelabel)) { | 
                                                        
| 1348 | -				print $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 1348 | +				print $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 1349 | 1349 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 1350 | 1350 |  				$placeholder = $langs->trans("RefOrLabel"); | 
                                                        
| 1351 | 1351 |  				if ($hidelabel == 2) { | 
                                                        
| 1352 | 1352 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 1353 | 1353 | }  | 
                                                        
| 1354 | 1354 | }  | 
                                                        
| 1355 | -			$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' : '') . ' />'; | 
                                                        |
| 1355 | +			$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' : '').' />'; | 
                                                        |
| 1356 | 1356 |  			if ($hidelabel == 3) { | 
                                                        
| 1357 | 1357 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 1358 | 1358 | }  | 
                                                        
| 1359 | 1359 | |
| 1360 | 1360 | $out .= ajax_event($htmlname, $events);  | 
                                                        
| 1361 | 1361 | |
| 1362 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);  | 
                                                        |
| 1362 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);  | 
                                                        |
| 1363 | 1363 |  		} else { | 
                                                        
| 1364 | 1364 | // Immediate load of all database  | 
                                                        
| 1365 | 1365 | $out .= $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple, $excludeids, $showcode);  | 
                                                        
@@ -1443,30 +1443,30 @@ discard block  | 
                                                    ||
| 1443 | 1443 | $sql .= ", s.address, s.zip, s.town";  | 
                                                        
| 1444 | 1444 | $sql .= ", dictp.code as country_code";  | 
                                                        
| 1445 | 1445 | }  | 
                                                        
| 1446 | - $sql .= " FROM " . $this->db->prefix() . "societe as s";  | 
                                                        |
| 1446 | + $sql .= " FROM ".$this->db->prefix()."societe as s";  | 
                                                        |
| 1447 | 1447 |  		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { | 
                                                        
| 1448 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";  | 
                                                        |
| 1448 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";  | 
                                                        |
| 1449 | 1449 | }  | 
                                                        
| 1450 | 1450 |  		if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 1451 | - $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";  | 
                                                        |
| 1451 | + $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";  | 
                                                        |
| 1452 | 1452 | }  | 
                                                        
| 1453 | -		$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; | 
                                                        |
| 1453 | +		$sql .= " WHERE s.entity IN (".getEntity('societe').")"; | 
                                                        |
| 1454 | 1454 |  		if (!empty($user->socid)) { | 
                                                        
| 1455 | - $sql .= " AND s.rowid = " . ((int) $user->socid);  | 
                                                        |
| 1455 | + $sql .= " AND s.rowid = ".((int) $user->socid);  | 
                                                        |
| 1456 | 1456 | }  | 
                                                        
| 1457 | 1457 |  		if ($filter) { | 
                                                        
| 1458 | 1458 |  			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() | 
                                                        
| 1459 | 1459 | // if not, by testSqlAndScriptInject() only.  | 
                                                        
| 1460 | -			$sql .= " AND (" . $filter . ")"; | 
                                                        |
| 1460 | +			$sql .= " AND (".$filter.")"; | 
                                                        |
| 1461 | 1461 | }  | 
                                                        
| 1462 | 1462 |  		if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 1463 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);  | 
                                                        |
| 1463 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);  | 
                                                        |
| 1464 | 1464 | }  | 
                                                        
| 1465 | 1465 |  		if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) { | 
                                                        
| 1466 | 1466 | $sql .= " AND s.status <> 0";  | 
                                                        
| 1467 | 1467 | }  | 
                                                        
| 1468 | 1468 |  		if (!empty($excludeids)) { | 
                                                        
| 1469 | -			$sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(join(',', $excludeids)) . ")"; | 
                                                        |
| 1469 | +			$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(join(',', $excludeids)).")"; | 
                                                        |
| 1470 | 1470 | }  | 
                                                        
| 1471 | 1471 | // Add where from hooks  | 
                                                        
| 1472 | 1472 | $parameters = array();  | 
                                                        
@@ -1486,17 +1486,17 @@ discard block  | 
                                                    ||
| 1486 | 1486 |  				if ($i > 0) { | 
                                                        
| 1487 | 1487 | $sql .= " AND ";  | 
                                                        
| 1488 | 1488 | }  | 
                                                        
| 1489 | - $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";  | 
                                                        |
| 1489 | + $sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";  | 
                                                        |
| 1490 | 1490 | $i++;  | 
                                                        
| 1491 | 1491 | }  | 
                                                        
| 1492 | 1492 |  			if (count($scrit) > 1) { | 
                                                        
| 1493 | 1493 | $sql .= ")";  | 
                                                        
| 1494 | 1494 | }  | 
                                                        
| 1495 | 1495 |  			if (isModEnabled('barcode')) { | 
                                                        
| 1496 | - $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 1496 | + $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 1497 | 1497 | }  | 
                                                        
| 1498 | - $sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 1499 | - $sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 1498 | + $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 1499 | + $sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 1500 | 1500 | $sql .= ")";  | 
                                                        
| 1501 | 1501 | }  | 
                                                        
| 1502 | 1502 |  		$sql .= $this->db->order("nom", "ASC"); | 
                                                        
@@ -1507,12 +1507,12 @@ discard block  | 
                                                    ||
| 1507 | 1507 | $resql = $this->db->query($sql);  | 
                                                        
| 1508 | 1508 |  		if ($resql) { | 
                                                        
| 1509 | 1509 |  			if (!$forcecombo) { | 
                                                        
| 1510 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1510 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1511 | 1511 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalString("COMPANY_USE_SEARCH_TO_SELECT")); | 
                                                        
| 1512 | 1512 | }  | 
                                                        
| 1513 | 1513 | |
| 1514 | 1514 | // Construct $out and $outarray  | 
                                                        
| 1515 | - $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";  | 
                                                        |
| 1515 | + $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";  | 
                                                        |
| 1516 | 1516 | |
| 1517 | 1517 | $textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : '');  | 
                                                        
| 1518 | 1518 |  			if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) { | 
                                                        
@@ -1525,7 +1525,7 @@ discard block  | 
                                                    ||
| 1525 | 1525 | }  | 
                                                        
| 1526 | 1526 | }  | 
                                                        
| 1527 | 1527 |  			if ($showempty) { | 
                                                        
| 1528 | -				$out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : ' ') . '</span>') . '">' . $textifempty . '</option>' . "\n"; | 
                                                        |
| 1528 | +				$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n"; | 
                                                        |
| 1529 | 1529 | }  | 
                                                        
| 1530 | 1530 | |
| 1531 | 1531 | $companytemp = new Societe($this->db);  | 
                                                        
@@ -1538,18 +1538,18 @@ discard block  | 
                                                    ||
| 1538 | 1538 | $label = '';  | 
                                                        
| 1539 | 1539 |  					if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { | 
                                                        
| 1540 | 1540 |  						if (($obj->client) && (!empty($obj->code_client))) { | 
                                                        
| 1541 | - $label = $obj->code_client . ' - ';  | 
                                                        |
| 1541 | + $label = $obj->code_client.' - ';  | 
                                                        |
| 1542 | 1542 | }  | 
                                                        
| 1543 | 1543 |  						if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { | 
                                                        
| 1544 | - $label .= $obj->code_fournisseur . ' - ';  | 
                                                        |
| 1544 | + $label .= $obj->code_fournisseur.' - ';  | 
                                                        |
| 1545 | 1545 | }  | 
                                                        
| 1546 | - $label .= ' ' . $obj->name;  | 
                                                        |
| 1546 | + $label .= ' '.$obj->name;  | 
                                                        |
| 1547 | 1547 |  					} else { | 
                                                        
| 1548 | 1548 | $label = $obj->name;  | 
                                                        
| 1549 | 1549 | }  | 
                                                        
| 1550 | 1550 | |
| 1551 | 1551 |  					if (!empty($obj->name_alias)) { | 
                                                        
| 1552 | -						$label .= ' (' . $obj->name_alias . ')'; | 
                                                        |
| 1552 | +						$label .= ' ('.$obj->name_alias.')'; | 
                                                        |
| 1553 | 1553 | }  | 
                                                        
| 1554 | 1554 | |
| 1555 | 1555 |  					if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) { | 
                                                        
@@ -1564,7 +1564,7 @@ discard block  | 
                                                    ||
| 1564 | 1564 | $companytemp->fournisseur = $obj->fournisseur;  | 
                                                        
| 1565 | 1565 | $tmptype = $companytemp->getTypeUrl(1, '', 0, 'span');  | 
                                                        
| 1566 | 1566 |  						if ($tmptype) { | 
                                                        
| 1567 | - $labelhtml .= ' ' . $tmptype;  | 
                                                        |
| 1567 | + $labelhtml .= ' '.$tmptype;  | 
                                                        |
| 1568 | 1568 | }  | 
                                                        
| 1569 | 1569 | |
| 1570 | 1570 |  						if ($obj->client || $obj->fournisseur) { | 
                                                        
@@ -1574,10 +1574,10 @@ discard block  | 
                                                    ||
| 1574 | 1574 |  							$label .= $langs->trans("Customer"); | 
                                                        
| 1575 | 1575 | }  | 
                                                        
| 1576 | 1576 |  						if ($obj->client == 2 || $obj->client == 3) { | 
                                                        
| 1577 | -							$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); | 
                                                        |
| 1577 | +							$label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); | 
                                                        |
| 1578 | 1578 | }  | 
                                                        
| 1579 | 1579 |  						if ($obj->fournisseur) { | 
                                                        
| 1580 | -							$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); | 
                                                        |
| 1580 | +							$label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); | 
                                                        |
| 1581 | 1581 | }  | 
                                                        
| 1582 | 1582 |  						if ($obj->client || $obj->fournisseur) { | 
                                                        
| 1583 | 1583 | $label .= ')';  | 
                                                        
@@ -1585,9 +1585,9 @@ discard block  | 
                                                    ||
| 1585 | 1585 | }  | 
                                                        
| 1586 | 1586 | |
| 1587 | 1587 |  					if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { | 
                                                        
| 1588 | - $s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : '');  | 
                                                        |
| 1588 | + $s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');  | 
                                                        |
| 1589 | 1589 |  						if (!empty($obj->country_code)) { | 
                                                        
| 1590 | -							$s .= ', ' . $langs->trans('Country' . $obj->country_code); | 
                                                        |
| 1590 | +							$s .= ', '.$langs->trans('Country'.$obj->country_code); | 
                                                        |
| 1591 | 1591 | }  | 
                                                        
| 1592 | 1592 | $label .= $s;  | 
                                                        
| 1593 | 1593 | $labelhtml .= $s;  | 
                                                        
@@ -1595,9 +1595,9 @@ discard block  | 
                                                    ||
| 1595 | 1595 | |
| 1596 | 1596 |  					if (empty($outputmode)) { | 
                                                        
| 1597 | 1597 |  						if (in_array($obj->rowid, $selected)) { | 
                                                        
| 1598 | - $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>';  | 
                                                        |
| 1598 | + $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>';  | 
                                                        |
| 1599 | 1599 |  						} else { | 
                                                        
| 1600 | - $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';  | 
                                                        |
| 1600 | + $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';  | 
                                                        |
| 1601 | 1601 | }  | 
                                                        
| 1602 | 1602 |  					} else { | 
                                                        
| 1603 | 1603 |  						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml)); | 
                                                        
@@ -1609,7 +1609,7 @@ discard block  | 
                                                    ||
| 1609 | 1609 | }  | 
                                                        
| 1610 | 1610 | }  | 
                                                        
| 1611 | 1611 | }  | 
                                                        
| 1612 | - $out .= '</select>' . "\n";  | 
                                                        |
| 1612 | + $out .= '</select>'."\n";  | 
                                                        |
| 1613 | 1613 |  		} else { | 
                                                        
| 1614 | 1614 | dol_print_error($this->db);  | 
                                                        
| 1615 | 1615 | }  | 
                                                        
@@ -1643,18 +1643,18 @@ discard block  | 
                                                    ||
| 1643 | 1643 | // On recherche les remises  | 
                                                        
| 1644 | 1644 | $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";  | 
                                                        
| 1645 | 1645 | $sql .= " re.description, re.fk_facture_source";  | 
                                                        
| 1646 | - $sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";  | 
                                                        |
| 1647 | - $sql .= " WHERE re.fk_soc = " . (int) $socid;  | 
                                                        |
| 1648 | - $sql .= " AND re.entity = " . $conf->entity;  | 
                                                        |
| 1646 | + $sql .= " FROM ".$this->db->prefix()."societe_remise_except as re";  | 
                                                        |
| 1647 | + $sql .= " WHERE re.fk_soc = ".(int) $socid;  | 
                                                        |
| 1648 | + $sql .= " AND re.entity = ".$conf->entity;  | 
                                                        |
| 1649 | 1649 |  		if ($filter) { | 
                                                        
| 1650 | - $sql .= " AND " . $filter;  | 
                                                        |
| 1650 | + $sql .= " AND ".$filter;  | 
                                                        |
| 1651 | 1651 | }  | 
                                                        
| 1652 | 1652 | $sql .= " ORDER BY re.description ASC";  | 
                                                        
| 1653 | 1653 | |
| 1654 | - dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);  | 
                                                        |
| 1654 | + dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);  | 
                                                        |
| 1655 | 1655 | $resql = $this->db->query($sql);  | 
                                                        
| 1656 | 1656 |  		if ($resql) { | 
                                                        
| 1657 | - print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">';  | 
                                                        |
| 1657 | + print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">';  | 
                                                        |
| 1658 | 1658 | $num = $this->db->num_rows($resql);  | 
                                                        
| 1659 | 1659 | |
| 1660 | 1660 | $qualifiedlines = $num;  | 
                                                        
@@ -1692,16 +1692,16 @@ discard block  | 
                                                    ||
| 1692 | 1692 |  					if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { | 
                                                        
| 1693 | 1693 | $tmpfac = new Facture($this->db);  | 
                                                        
| 1694 | 1694 |  						if ($tmpfac->fetch($obj->fk_facture_source) > 0) { | 
                                                        
| 1695 | - $desc = $desc . ' - ' . $tmpfac->ref;  | 
                                                        |
| 1695 | + $desc = $desc.' - '.$tmpfac->ref;  | 
                                                        |
| 1696 | 1696 | }  | 
                                                        
| 1697 | 1697 | }  | 
                                                        
| 1698 | 1698 | |
| 1699 | -					print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; | 
                                                        |
| 1699 | +					print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; | 
                                                        |
| 1700 | 1700 | $i++;  | 
                                                        
| 1701 | 1701 | }  | 
                                                        
| 1702 | 1702 | }  | 
                                                        
| 1703 | 1703 | print '</select>';  | 
                                                        
| 1704 | -			print ajax_combobox('select_' . $htmlname); | 
                                                        |
| 1704 | +			print ajax_combobox('select_'.$htmlname); | 
                                                        |
| 1705 | 1705 | |
| 1706 | 1706 | return $qualifiedlines;  | 
                                                        
| 1707 | 1707 |  		} else { | 
                                                        
@@ -1782,7 +1782,7 @@ discard block  | 
                                                    ||
| 1782 | 1782 | $out = '';  | 
                                                        
| 1783 | 1783 | |
| 1784 | 1784 |  		if (!is_object($hookmanager)) { | 
                                                        
| 1785 | - include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';  | 
                                                        |
| 1785 | + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';  | 
                                                        |
| 1786 | 1786 | $hookmanager = new HookManager($this->db);  | 
                                                        
| 1787 | 1787 | }  | 
                                                        
| 1788 | 1788 | |
@@ -1791,13 +1791,13 @@ discard block  | 
                                                    ||
| 1791 | 1791 |  		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { | 
                                                        
| 1792 | 1792 | $sql .= ", s.nom as company, s.town AS company_town";  | 
                                                        
| 1793 | 1793 | }  | 
                                                        
| 1794 | - $sql .= " FROM " . $this->db->prefix() . "socpeople as sp";  | 
                                                        |
| 1794 | + $sql .= " FROM ".$this->db->prefix()."socpeople as sp";  | 
                                                        |
| 1795 | 1795 |  		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { | 
                                                        
| 1796 | - $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";  | 
                                                        |
| 1796 | + $sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";  | 
                                                        |
| 1797 | 1797 | }  | 
                                                        
| 1798 | -		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; | 
                                                        |
| 1798 | +		$sql .= " WHERE sp.entity IN (".getEntity('contact').")"; | 
                                                        |
| 1799 | 1799 |  		if ($socid > 0 || $socid == -1) { | 
                                                        
| 1800 | - $sql .= " AND sp.fk_soc = " . ((int) $socid);  | 
                                                        |
| 1800 | + $sql .= " AND sp.fk_soc = ".((int) $socid);  | 
                                                        |
| 1801 | 1801 | }  | 
                                                        
| 1802 | 1802 |  		if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { | 
                                                        
| 1803 | 1803 | $sql .= " AND sp.statut <> 0";  | 
                                                        
@@ -1808,30 +1808,30 @@ discard block  | 
                                                    ||
| 1808 | 1808 | $sql .= $hookmanager->resPrint;  | 
                                                        
| 1809 | 1809 | $sql .= " ORDER BY sp.lastname ASC";  | 
                                                        
| 1810 | 1810 | |
| 1811 | - dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG);  | 
                                                        |
| 1811 | + dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);  | 
                                                        |
| 1812 | 1812 | $resql = $this->db->query($sql);  | 
                                                        
| 1813 | 1813 |  		if ($resql) { | 
                                                        
| 1814 | 1814 | $num = $this->db->num_rows($resql);  | 
                                                        
| 1815 | 1815 | |
| 1816 | 1816 |  			if ($htmlname != 'none' && !$options_only) { | 
                                                        
| 1817 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';  | 
                                                        |
| 1817 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';  | 
                                                        |
| 1818 | 1818 | }  | 
                                                        
| 1819 | 1819 | |
| 1820 | 1820 |  			if ($showempty && !is_numeric($showempty)) { | 
                                                        
| 1821 | 1821 | $textforempty = $showempty;  | 
                                                        
| 1822 | - $out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>';  | 
                                                        |
| 1822 | + $out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';  | 
                                                        |
| 1823 | 1823 |  			} else { | 
                                                        
| 1824 | 1824 |  				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { | 
                                                        
| 1825 | - $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>';  | 
                                                        |
| 1825 | + $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>';  | 
                                                        |
| 1826 | 1826 | }  | 
                                                        
| 1827 | 1827 |  				if ($showempty == 2) { | 
                                                        
| 1828 | -					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; | 
                                                        |
| 1828 | +					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; | 
                                                        |
| 1829 | 1829 | }  | 
                                                        
| 1830 | 1830 | }  | 
                                                        
| 1831 | 1831 | |
| 1832 | 1832 | $i = 0;  | 
                                                        
| 1833 | 1833 |  			if ($num) { | 
                                                        
| 1834 | - include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';  | 
                                                        |
| 1834 | + include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';  | 
                                                        |
| 1835 | 1835 | $contactstatic = new Contact($this->db);  | 
                                                        
| 1836 | 1836 | |
| 1837 | 1837 |  				while ($i < $num) { | 
                                                        
@@ -1867,7 +1867,7 @@ discard block  | 
                                                    ||
| 1867 | 1867 | }  | 
                                                        
| 1868 | 1868 |  						$extendedInfos = implode(' - ', $extendedInfos); | 
                                                        
| 1869 | 1869 |  						if (!empty($extendedInfos)) { | 
                                                        
| 1870 | - $extendedInfos = ' - ' . $extendedInfos;  | 
                                                        |
| 1870 | + $extendedInfos = ' - '.$extendedInfos;  | 
                                                        |
| 1871 | 1871 | }  | 
                                                        
| 1872 | 1872 | }  | 
                                                        
| 1873 | 1873 | |
@@ -1884,42 +1884,42 @@ discard block  | 
                                                    ||
| 1884 | 1884 | $disabled = 1;  | 
                                                        
| 1885 | 1885 | }  | 
                                                        
| 1886 | 1886 |  							if (!empty($selected) && in_array($obj->rowid, $selected)) { | 
                                                        
| 1887 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 1887 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 1888 | 1888 |  								if ($disabled) { | 
                                                        
| 1889 | 1889 | $out .= ' disabled';  | 
                                                        
| 1890 | 1890 | }  | 
                                                        
| 1891 | 1891 | $out .= ' selected>';  | 
                                                        
| 1892 | - $out .= $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        |
| 1892 | + $out .= $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        |
| 1893 | 1893 |  								if ($showfunction && $obj->poste) { | 
                                                        
| 1894 | -									$out .= ' (' . $obj->poste . ')'; | 
                                                        |
| 1894 | +									$out .= ' ('.$obj->poste.')'; | 
                                                        |
| 1895 | 1895 | }  | 
                                                        
| 1896 | 1896 |  								if (($showsoc > 0) && $obj->company) { | 
                                                        
| 1897 | -									$out .= ' - (' . $obj->company . ')'; | 
                                                        |
| 1897 | +									$out .= ' - ('.$obj->company.')'; | 
                                                        |
| 1898 | 1898 | }  | 
                                                        
| 1899 | 1899 | $out .= '</option>';  | 
                                                        
| 1900 | 1900 |  							} else { | 
                                                        
| 1901 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 1901 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 1902 | 1902 |  								if ($disabled) { | 
                                                        
| 1903 | 1903 | $out .= ' disabled';  | 
                                                        
| 1904 | 1904 | }  | 
                                                        
| 1905 | 1905 | $out .= '>';  | 
                                                        
| 1906 | - $out .= $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        |
| 1906 | + $out .= $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        |
| 1907 | 1907 |  								if ($showfunction && $obj->poste) { | 
                                                        
| 1908 | -									$out .= ' (' . $obj->poste . ')'; | 
                                                        |
| 1908 | +									$out .= ' ('.$obj->poste.')'; | 
                                                        |
| 1909 | 1909 | }  | 
                                                        
| 1910 | 1910 |  								if (($showsoc > 0) && $obj->company) { | 
                                                        
| 1911 | -									$out .= ' - (' . $obj->company . ')'; | 
                                                        |
| 1911 | +									$out .= ' - ('.$obj->company.')'; | 
                                                        |
| 1912 | 1912 | }  | 
                                                        
| 1913 | 1913 | $out .= '</option>';  | 
                                                        
| 1914 | 1914 | }  | 
                                                        
| 1915 | 1915 |  						} else { | 
                                                        
| 1916 | 1916 |  							if (in_array($obj->rowid, $selected)) { | 
                                                        
| 1917 | - $out .= $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        |
| 1917 | + $out .= $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        |
| 1918 | 1918 |  								if ($showfunction && $obj->poste) { | 
                                                        
| 1919 | -									$out .= ' (' . $obj->poste . ')'; | 
                                                        |
| 1919 | +									$out .= ' ('.$obj->poste.')'; | 
                                                        |
| 1920 | 1920 | }  | 
                                                        
| 1921 | 1921 |  								if (($showsoc > 0) && $obj->company) { | 
                                                        
| 1922 | -									$out .= ' - (' . $obj->company . ')'; | 
                                                        |
| 1922 | +									$out .= ' - ('.$obj->company.')'; | 
                                                        |
| 1923 | 1923 | }  | 
                                                        
| 1924 | 1924 | }  | 
                                                        
| 1925 | 1925 | }  | 
                                                        
@@ -1928,7 +1928,7 @@ discard block  | 
                                                    ||
| 1928 | 1928 | }  | 
                                                        
| 1929 | 1929 |  			} else { | 
                                                        
| 1930 | 1930 |  				$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); | 
                                                        
| 1931 | - $out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">';  | 
                                                        |
| 1931 | + $out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">';  | 
                                                        |
| 1932 | 1932 | $out .= $labeltoshow;  | 
                                                        
| 1933 | 1933 | $out .= '</option>';  | 
                                                        
| 1934 | 1934 | }  | 
                                                        
@@ -1949,7 +1949,7 @@ discard block  | 
                                                    ||
| 1949 | 1949 | }  | 
                                                        
| 1950 | 1950 | |
| 1951 | 1951 |  			if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { | 
                                                        
| 1952 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1952 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1953 | 1953 |  				$out .= ajax_combobox($htmlid, $events, getDolGlobalString("CONTACT_USE_SEARCH_TO_SELECT")); | 
                                                        
| 1954 | 1954 | }  | 
                                                        
| 1955 | 1955 | |
@@ -2054,11 +2054,11 @@ discard block  | 
                                                    ||
| 2054 | 2054 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
| 2055 | 2055 | $sql .= ", e.label";  | 
                                                        
| 2056 | 2056 | }  | 
                                                        
| 2057 | - $sql .= " FROM " . $this->db->prefix() . "user as u";  | 
                                                        |
| 2057 | + $sql .= " FROM ".$this->db->prefix()."user as u";  | 
                                                        |
| 2058 | 2058 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
| 2059 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";  | 
                                                        |
| 2059 | + $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";  | 
                                                        |
| 2060 | 2060 |  			if (!empty($force_entity)) { | 
                                                        
| 2061 | - $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";  | 
                                                        |
| 2061 | + $sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";  | 
                                                        |
| 2062 | 2062 |  			} else { | 
                                                        
| 2063 | 2063 | $sql .= " WHERE u.entity IS NOT NULL";  | 
                                                        
| 2064 | 2064 | }  | 
                                                        
@@ -2066,17 +2066,17 @@ discard block  | 
                                                    ||
| 2066 | 2066 |  			if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { | 
                                                        
| 2067 | 2067 |  				$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; | 
                                                        
| 2068 | 2068 |  			} else { | 
                                                        
| 2069 | -				$sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; | 
                                                        |
| 2069 | +				$sql .= " WHERE u.entity IN (".getEntity('user').")"; | 
                                                        |
| 2070 | 2070 | }  | 
                                                        
| 2071 | 2071 | }  | 
                                                        
| 2072 | 2072 |  		if (!empty($user->socid)) { | 
                                                        
| 2073 | - $sql .= " AND u.fk_soc = " . ((int) $user->socid);  | 
                                                        |
| 2073 | + $sql .= " AND u.fk_soc = ".((int) $user->socid);  | 
                                                        |
| 2074 | 2074 | }  | 
                                                        
| 2075 | 2075 |  		if (is_array($exclude) && $excludeUsers) { | 
                                                        
| 2076 | -			$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; | 
                                                        |
| 2076 | +			$sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; | 
                                                        |
| 2077 | 2077 | }  | 
                                                        
| 2078 | 2078 |  		if ($includeUsers) { | 
                                                        
| 2079 | -			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; | 
                                                        |
| 2079 | +			$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; | 
                                                        |
| 2080 | 2080 | }  | 
                                                        
| 2081 | 2081 |  		if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { | 
                                                        
| 2082 | 2082 | $sql .= " AND u.statut <> 0";  | 
                                                        
@@ -2088,7 +2088,7 @@ discard block  | 
                                                    ||
| 2088 | 2088 | $sql .= " AND u.fk_soc IS NULL";  | 
                                                        
| 2089 | 2089 | }  | 
                                                        
| 2090 | 2090 |  		if (!empty($morefilter)) { | 
                                                        
| 2091 | - $sql .= " " . $morefilter;  | 
                                                        |
| 2091 | + $sql .= " ".$morefilter;  | 
                                                        |
| 2092 | 2092 | }  | 
                                                        
| 2093 | 2093 | |
| 2094 | 2094 | //Add hook to filter on user (for example on usergroup define in custom modules)  | 
                                                        
@@ -2103,7 +2103,7 @@ discard block  | 
                                                    ||
| 2103 | 2103 | $sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";  | 
                                                        
| 2104 | 2104 | }  | 
                                                        
| 2105 | 2105 | |
| 2106 | - dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG);  | 
                                                        |
| 2106 | + dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);  | 
                                                        |
| 2107 | 2107 | |
| 2108 | 2108 | $resql = $this->db->query($sql);  | 
                                                        
| 2109 | 2109 |  		if ($resql) { | 
                                                        
@@ -2111,7 +2111,7 @@ discard block  | 
                                                    ||
| 2111 | 2111 | $i = 0;  | 
                                                        
| 2112 | 2112 |  			if ($num) { | 
                                                        
| 2113 | 2113 | // do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined  | 
                                                        
| 2114 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 2114 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 2115 | 2115 |  				if ($show_empty && !$multiple) { | 
                                                        
| 2116 | 2116 | $textforempty = ' ';  | 
                                                        
| 2117 | 2117 |  					if (!empty($conf->use_javascript_ajax)) { | 
                                                        
@@ -2120,10 +2120,10 @@ discard block  | 
                                                    ||
| 2120 | 2120 |  					if (!is_numeric($show_empty)) { | 
                                                        
| 2121 | 2121 | $textforempty = $show_empty;  | 
                                                        
| 2122 | 2122 | }  | 
                                                        
| 2123 | - $out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";  | 
                                                        |
| 2123 | + $out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n";  | 
                                                        |
| 2124 | 2124 | }  | 
                                                        
| 2125 | 2125 |  				if ($show_every) { | 
                                                        
| 2126 | -					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; | 
                                                        |
| 2126 | +					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; | 
                                                        |
| 2127 | 2127 | }  | 
                                                        
| 2128 | 2128 | |
| 2129 | 2129 | $userstatic = new User($this->db);  | 
                                                        
@@ -2170,22 +2170,22 @@ discard block  | 
                                                    ||
| 2170 | 2170 | }  | 
                                                        
| 2171 | 2171 |  					if ($showstatus >= 0) { | 
                                                        
| 2172 | 2172 |  						if ($obj->status == 1 && $showstatus == 1) { | 
                                                        
| 2173 | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); | 
                                                        |
| 2174 | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); | 
                                                        |
| 2173 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); | 
                                                        |
| 2174 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); | 
                                                        |
| 2175 | 2175 | }  | 
                                                        
| 2176 | 2176 |  						if ($obj->status == 0 && $showstatus == 1) { | 
                                                        
| 2177 | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); | 
                                                        |
| 2178 | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); | 
                                                        |
| 2177 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); | 
                                                        |
| 2178 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); | 
                                                        |
| 2179 | 2179 | }  | 
                                                        
| 2180 | 2180 | }  | 
                                                        
| 2181 | 2181 |  					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && !empty($user->admin) && empty($user->entity)) { | 
                                                        
| 2182 | 2182 |  						if (empty($obj->entity)) { | 
                                                        
| 2183 | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); | 
                                                        |
| 2184 | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); | 
                                                        |
| 2183 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); | 
                                                        |
| 2184 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); | 
                                                        |
| 2185 | 2185 |  						} else { | 
                                                        
| 2186 | 2186 |  							if ($obj->entity != $conf->entity) { | 
                                                        
| 2187 | -								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        |
| 2188 | -								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        |
| 2187 | +								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        |
| 2188 | +								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        |
| 2189 | 2189 | }  | 
                                                        
| 2190 | 2190 | }  | 
                                                        
| 2191 | 2191 | }  | 
                                                        
@@ -2193,13 +2193,13 @@ discard block  | 
                                                    ||
| 2193 | 2193 | $moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : '');  | 
                                                        
| 2194 | 2194 |  					if (!empty($disableline) && $disableline != '1') { | 
                                                        
| 2195 | 2195 | // Add text from $enableonlytext parameter  | 
                                                        
| 2196 | - $moreinfo .= ' - ' . $disableline;  | 
                                                        |
| 2197 | - $moreinfohtml .= ' - ' . $disableline;  | 
                                                        |
| 2196 | + $moreinfo .= ' - '.$disableline;  | 
                                                        |
| 2197 | + $moreinfohtml .= ' - '.$disableline;  | 
                                                        |
| 2198 | 2198 | }  | 
                                                        
| 2199 | 2199 | $labeltoshow .= $moreinfo;  | 
                                                        
| 2200 | 2200 | $labeltoshowhtml .= $moreinfohtml;  | 
                                                        
| 2201 | 2201 | |
| 2202 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 2202 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 2203 | 2203 |  					if (!empty($disableline)) { | 
                                                        
| 2204 | 2204 | $out .= ' disabled';  | 
                                                        
| 2205 | 2205 | }  | 
                                                        
@@ -2207,7 +2207,7 @@ discard block  | 
                                                    ||
| 2207 | 2207 | $out .= ' selected';  | 
                                                        
| 2208 | 2208 | }  | 
                                                        
| 2209 | 2209 | $out .= ' data-html="';  | 
                                                        
| 2210 | - $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' ';  | 
                                                        |
| 2210 | + $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';  | 
                                                        |
| 2211 | 2211 |  					if ($showstatus >= 0 && $obj->status == 0) { | 
                                                        
| 2212 | 2212 | $outhtml .= '<strike class="opacitymediumxxx">';  | 
                                                        
| 2213 | 2213 | }  | 
                                                        
@@ -2220,7 +2220,7 @@ discard block  | 
                                                    ||
| 2220 | 2220 | $out .= $labeltoshow;  | 
                                                        
| 2221 | 2221 | $out .= '</option>';  | 
                                                        
| 2222 | 2222 | |
| 2223 | - $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;  | 
                                                        |
| 2223 | + $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;  | 
                                                        |
| 2224 | 2224 | $outarray2[$userstatic->id] = array(  | 
                                                        
| 2225 | 2225 | 'id'=>$userstatic->id,  | 
                                                        
| 2226 | 2226 | 'label'=>$labeltoshow,  | 
                                                        
@@ -2232,14 +2232,14 @@ discard block  | 
                                                    ||
| 2232 | 2232 | $i++;  | 
                                                        
| 2233 | 2233 | }  | 
                                                        
| 2234 | 2234 |  			} else { | 
                                                        
| 2235 | - $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';  | 
                                                        |
| 2236 | -				$out .= '<option value="">' . $langs->trans("None") . '</option>'; | 
                                                        |
| 2235 | + $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';  | 
                                                        |
| 2236 | +				$out .= '<option value="">'.$langs->trans("None").'</option>'; | 
                                                        |
| 2237 | 2237 | }  | 
                                                        
| 2238 | 2238 | $out .= '</select>';  | 
                                                        
| 2239 | 2239 | |
| 2240 | 2240 |  			if ($num && !$forcecombo) { | 
                                                        
| 2241 | 2241 | // Enhance with select2  | 
                                                        
| 2242 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 2242 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 2243 | 2243 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 2244 | 2244 | }  | 
                                                        
| 2245 | 2245 |  		} else { | 
                                                        
@@ -2309,16 +2309,16 @@ discard block  | 
                                                    ||
| 2309 | 2309 | $out .= $userstatic->getNomUrl(-1);  | 
                                                        
| 2310 | 2310 |  			if ($i == 0) { | 
                                                        
| 2311 | 2311 | $ownerid = $value['id'];  | 
                                                        
| 2312 | -				$out .= ' (' . $langs->trans("Owner") . ')'; | 
                                                        |
| 2312 | +				$out .= ' ('.$langs->trans("Owner").')'; | 
                                                        |
| 2313 | 2313 | }  | 
                                                        
| 2314 | 2314 |  			if ($nbassignetouser > 1 && $action != 'view') { | 
                                                        
| 2315 | -				$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 . '">'; | 
                                                        |
| 2315 | +				$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.'">'; | 
                                                        |
| 2316 | 2316 | }  | 
                                                        
| 2317 | 2317 | // Show my availability  | 
                                                        
| 2318 | 2318 |  			if ($showproperties) { | 
                                                        
| 2319 | 2319 |  				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { | 
                                                        
| 2320 | 2320 | $out .= '<div class="myavailability inline-block">';  | 
                                                        
| 2321 | -					$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>'; | 
                                                        |
| 2321 | +					$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>'; | 
                                                        |
| 2322 | 2322 | $out .= '</div>';  | 
                                                        
| 2323 | 2323 | }  | 
                                                        
| 2324 | 2324 | }  | 
                                                        
@@ -2335,15 +2335,15 @@ discard block  | 
                                                    ||
| 2335 | 2335 | // Method with no ajax  | 
                                                        
| 2336 | 2336 |  		if ($action != 'view') { | 
                                                        
| 2337 | 2337 | $out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';  | 
                                                        
| 2338 | -			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2338 | +			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2339 | 2339 |  			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; | 
                                                        
| 2340 | 2340 |  			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; | 
                                                        
| 2341 | -			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; | 
                                                        |
| 2342 | -			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; | 
                                                        |
| 2341 | +			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; | 
                                                        |
| 2342 | +			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; | 
                                                        |
| 2343 | 2343 | $out .= '});';  | 
                                                        
| 2344 | 2344 | $out .= '})</script>';  | 
                                                        
| 2345 | 2345 |  			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); | 
                                                        
| 2346 | -			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; | 
                                                        |
| 2346 | +			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; | 
                                                        |
| 2347 | 2347 | $out .= '<br>';  | 
                                                        
| 2348 | 2348 | }  | 
                                                        
| 2349 | 2349 | |
@@ -2398,13 +2398,13 @@ discard block  | 
                                                    ||
| 2398 | 2398 | $resourcestatic->fetch($value['id']);  | 
                                                        
| 2399 | 2399 | $out .= $resourcestatic->getNomUrl(-1);  | 
                                                        
| 2400 | 2400 |  			if ($nbassignetoresource > 1 && $action != 'view') { | 
                                                        
| 2401 | -				$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 . '">'; | 
                                                        |
| 2401 | +				$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.'">'; | 
                                                        |
| 2402 | 2402 | }  | 
                                                        
| 2403 | 2403 | // Show my availability  | 
                                                        
| 2404 | 2404 |  			if ($showproperties) { | 
                                                        
| 2405 | 2405 |  				if (is_array($listofresourceid) && count($listofresourceid)) { | 
                                                        
| 2406 | 2406 | $out .= '<div class="myavailability inline-block">';  | 
                                                        
| 2407 | -					$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>'; | 
                                                        |
| 2407 | +					$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>'; | 
                                                        |
| 2408 | 2408 | $out .= '</div>';  | 
                                                        
| 2409 | 2409 | }  | 
                                                        
| 2410 | 2410 | }  | 
                                                        
@@ -2421,11 +2421,11 @@ discard block  | 
                                                    ||
| 2421 | 2421 | // Method with no ajax  | 
                                                        
| 2422 | 2422 |  		if ($action != 'view') { | 
                                                        
| 2423 | 2423 | $out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">';  | 
                                                        
| 2424 | -			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2424 | +			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2425 | 2425 |  			$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; | 
                                                        
| 2426 | 2426 |  			$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; | 
                                                        
| 2427 | -			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; | 
                                                        |
| 2428 | -			$out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; | 
                                                        |
| 2427 | +			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; | 
                                                        |
| 2428 | +			$out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; | 
                                                        |
| 2429 | 2429 | $out .= '});';  | 
                                                        
| 2430 | 2430 | $out .= '})</script>';  | 
                                                        
| 2431 | 2431 | |
@@ -2433,7 +2433,7 @@ discard block  | 
                                                    ||
| 2433 | 2433 |  			$out .= img_picto('', 'resource', 'class="pictofixedwidth"'); | 
                                                        
| 2434 | 2434 | $out .= $formresources->select_resource_list(0, $htmlname, '', 1, 1, 0, $events, '', 2, null);  | 
                                                        
| 2435 | 2435 |  			//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); | 
                                                        
| 2436 | -			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; | 
                                                        |
| 2436 | +			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; | 
                                                        |
| 2437 | 2437 | $out .= '<br>';  | 
                                                        
| 2438 | 2438 | }  | 
                                                        
| 2439 | 2439 | |
@@ -2494,7 +2494,7 @@ discard block  | 
                                                    ||
| 2494 | 2494 | $placeholder = '';  | 
                                                        
| 2495 | 2495 | |
| 2496 | 2496 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 2497 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 2497 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 2498 | 2498 | $producttmpselect = new Product($this->db);  | 
                                                        
| 2499 | 2499 | $producttmpselect->fetch($selected);  | 
                                                        
| 2500 | 2500 | $selected_input_value = $producttmpselect->ref;  | 
                                                        
@@ -2509,17 +2509,17 @@ discard block  | 
                                                    ||
| 2509 | 2509 | }  | 
                                                        
| 2510 | 2510 | }  | 
                                                        
| 2511 | 2511 | // mode=1 means customers products  | 
                                                        
| 2512 | - $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;  | 
                                                        |
| 2513 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 2512 | + $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;  | 
                                                        |
| 2513 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 2514 | 2514 | |
| 2515 | 2515 |  			if (isModEnabled('variants') && is_array($selected_combinations)) { | 
                                                        
| 2516 | 2516 | // Code to automatically insert with javascript the select of attributes under the select of product  | 
                                                        
| 2517 | 2517 | // when a parent of variant has been selected.  | 
                                                        
| 2518 | 2518 | $out .= '  | 
                                                        
| 2519 | 2519 | <!-- script to auto show attributes select tags if a variant was selected -->  | 
                                                        
| 2520 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 2520 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 2521 | 2521 | // auto show attributes fields  | 
                                                        
| 2522 | - selected = ' . json_encode($selected_combinations) . ';  | 
                                                        |
| 2522 | + selected = ' . json_encode($selected_combinations).';  | 
                                                        |
| 2523 | 2523 |  					combvalues = {}; | 
                                                        
| 2524 | 2524 | |
| 2525 | 2525 |  					jQuery(document).ready(function () { | 
                                                        
@@ -2530,7 +2530,7 @@ discard block  | 
                                                    ||
| 2530 | 2530 | }  | 
                                                        
| 2531 | 2531 | });  | 
                                                        
| 2532 | 2532 | |
| 2533 | -						jQuery("input#' . $htmlname . '").change(function () { | 
                                                        |
| 2533 | +						jQuery("input#' . $htmlname.'").change(function () { | 
                                                        |
| 2534 | 2534 | |
| 2535 | 2535 |  							if (!jQuery(this).val()) { | 
                                                        
| 2536 | 2536 | jQuery(\'div#attributes_box\').empty();  | 
                                                        
@@ -2539,7 +2539,7 @@ discard block  | 
                                                    ||
| 2539 | 2539 | |
| 2540 | 2540 |  							console.log("A change has started. We get variants fields to inject html select"); | 
                                                        
| 2541 | 2541 | |
| 2542 | -							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { | 
                                                        |
| 2542 | +							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { | 
                                                        |
| 2543 | 2543 | id: jQuery(this).val()  | 
                                                        
| 2544 | 2544 |  							}, function (data) { | 
                                                        
| 2545 | 2545 | jQuery(\'div#attributes_box\').empty();  | 
                                                        
@@ -2582,21 +2582,21 @@ discard block  | 
                                                    ||
| 2582 | 2582 | })  | 
                                                        
| 2583 | 2583 | });  | 
                                                        
| 2584 | 2584 | |
| 2585 | -						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' | 
                                                        |
| 2585 | +						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' | 
                                                        |
| 2586 | 2586 | });  | 
                                                        
| 2587 | 2587 | </script>  | 
                                                        
| 2588 | 2588 | ';  | 
                                                        
| 2589 | 2589 | }  | 
                                                        
| 2590 | 2590 | |
| 2591 | 2591 |  			if (empty($hidelabel)) { | 
                                                        
| 2592 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 2592 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 2593 | 2593 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 2594 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 2594 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 2595 | 2595 |  				if ($hidelabel == 2) { | 
                                                        
| 2596 | 2596 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 2597 | 2597 | }  | 
                                                        
| 2598 | 2598 | }  | 
                                                        
| 2599 | -			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 2599 | +			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 2600 | 2600 |  			if ($hidelabel == 3) { | 
                                                        
| 2601 | 2601 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 2602 | 2602 | }  | 
                                                        
@@ -2633,33 +2633,33 @@ discard block  | 
                                                    ||
| 2633 | 2633 | // phpcs:enable  | 
                                                        
| 2634 | 2634 | global $conf, $user, $langs, $db;  | 
                                                        
| 2635 | 2635 | |
| 2636 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 2636 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 2637 | 2637 | |
| 2638 | 2638 | $error = 0;  | 
                                                        
| 2639 | 2639 | $out = '';  | 
                                                        
| 2640 | 2640 | |
| 2641 | 2641 |  		if (!$forcecombo) { | 
                                                        
| 2642 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 2642 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 2643 | 2643 | $events = array();  | 
                                                        
| 2644 | 2644 |  			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); | 
                                                        
| 2645 | 2645 | }  | 
                                                        
| 2646 | 2646 | |
| 2647 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 2647 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 2648 | 2648 | |
| 2649 | 2649 | $sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';  | 
                                                        
| 2650 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';  | 
                                                        |
| 2651 | -		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; | 
                                                        |
| 2650 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';  | 
                                                        |
| 2651 | +		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; | 
                                                        |
| 2652 | 2652 |  		if (!empty($status)) { | 
                                                        
| 2653 | - $sql .= ' AND status = ' . (int) $status;  | 
                                                        |
| 2653 | + $sql .= ' AND status = '.(int) $status;  | 
                                                        |
| 2654 | 2654 | }  | 
                                                        
| 2655 | 2655 |  		if (!empty($type)) { | 
                                                        
| 2656 | - $sql .= ' AND bomtype = ' . (int) $type;  | 
                                                        |
| 2656 | + $sql .= ' AND bomtype = '.(int) $type;  | 
                                                        |
| 2657 | 2657 | }  | 
                                                        
| 2658 | 2658 |  		if (!empty($TProducts)) { | 
                                                        
| 2659 | -			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; | 
                                                        |
| 2659 | +			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; | 
                                                        |
| 2660 | 2660 | }  | 
                                                        
| 2661 | 2661 |  		if (!empty($limit)) { | 
                                                        
| 2662 | - $sql .= ' LIMIT ' . (int) $limit;  | 
                                                        |
| 2662 | + $sql .= ' LIMIT '.(int) $limit;  | 
                                                        |
| 2663 | 2663 | }  | 
                                                        
| 2664 | 2664 | $resql = $db->query($sql);  | 
                                                        
| 2665 | 2665 |  		if ($resql) { | 
                                                        
@@ -2673,11 +2673,11 @@ discard block  | 
                                                    ||
| 2673 | 2673 |  			while ($obj = $db->fetch_object($resql)) { | 
                                                        
| 2674 | 2674 | $product = new Product($db);  | 
                                                        
| 2675 | 2675 | $res = $product->fetch($obj->fk_product);  | 
                                                        
| 2676 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 2676 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 2677 | 2677 |  				if ($obj->rowid == $selected) { | 
                                                        
| 2678 | 2678 | $out .= 'selected';  | 
                                                        
| 2679 | 2679 | }  | 
                                                        
| 2680 | - $out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';  | 
                                                        |
| 2680 | + $out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';  | 
                                                        |
| 2681 | 2681 | }  | 
                                                        
| 2682 | 2682 |  		} else { | 
                                                        
| 2683 | 2683 | $error++;  | 
                                                        
@@ -2734,7 +2734,7 @@ discard block  | 
                                                    ||
| 2734 | 2734 | |
| 2735 | 2735 | $warehouseStatusArray = array();  | 
                                                        
| 2736 | 2736 |  		if (!empty($warehouseStatus)) { | 
                                                        
| 2737 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';  | 
                                                        |
| 2737 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';  | 
                                                        |
| 2738 | 2738 |  			if (preg_match('/warehouseclosed/', $warehouseStatus)) { | 
                                                        
| 2739 | 2739 | $warehouseStatusArray[] = Entrepot::STATUS_CLOSED;  | 
                                                        
| 2740 | 2740 | }  | 
                                                        
@@ -2748,9 +2748,9 @@ discard block  | 
                                                    ||
| 2748 | 2748 | |
| 2749 | 2749 | $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";  | 
                                                        
| 2750 | 2750 |  		if (count($warehouseStatusArray)) { | 
                                                        
| 2751 | -			$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 | 
                                                        |
| 2751 | +			$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 | 
                                                        |
| 2752 | 2752 |  		} else { | 
                                                        
| 2753 | -			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; | 
                                                        |
| 2753 | +			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; | 
                                                        |
| 2754 | 2754 | }  | 
                                                        
| 2755 | 2755 | |
| 2756 | 2756 | $sql = "SELECT ";  | 
                                                        
@@ -2766,9 +2766,9 @@ discard block  | 
                                                    ||
| 2766 | 2766 | |
| 2767 | 2767 |  		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { | 
                                                        
| 2768 | 2768 | //Product category  | 
                                                        
| 2769 | - $sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie  | 
                                                        |
| 2770 | - FROM " . $this->db->prefix() . "categorie_product  | 
                                                        |
| 2771 | - WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid  | 
                                                        |
| 2769 | + $sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie  | 
                                                        |
| 2770 | + FROM " . $this->db->prefix()."categorie_product  | 
                                                        |
| 2771 | + WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid  | 
                                                        |
| 2772 | 2772 | LIMIT 1  | 
                                                        
| 2773 | 2773 | ) AS categorie_product_id ";  | 
                                                        
| 2774 | 2774 | }  | 
                                                        
@@ -2794,15 +2794,15 @@ discard block  | 
                                                    ||
| 2794 | 2794 | }  | 
                                                        
| 2795 | 2795 | // Price by quantity  | 
                                                        
| 2796 | 2796 |  		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
| 2797 | - $sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";  | 
                                                        |
| 2797 | + $sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";  | 
                                                        |
| 2798 | 2798 |  			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
| 2799 | - $sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        |
| 2799 | + $sql .= " AND price_level = ".((int) $price_level);  | 
                                                        |
| 2800 | 2800 | }  | 
                                                        
| 2801 | 2801 | $sql .= " ORDER BY date_price";  | 
                                                        
| 2802 | 2802 | $sql .= " DESC LIMIT 1) as price_rowid";  | 
                                                        
| 2803 | - $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  | 
                                                        |
| 2803 | + $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  | 
                                                        |
| 2804 | 2804 |  			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
| 2805 | - $sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        |
| 2805 | + $sql .= " AND price_level = ".((int) $price_level);  | 
                                                        |
| 2806 | 2806 | }  | 
                                                        
| 2807 | 2807 | $sql .= " ORDER BY date_price";  | 
                                                        
| 2808 | 2808 | $sql .= " DESC LIMIT 1) as price_by_qty";  | 
                                                        
@@ -2816,53 +2816,53 @@ discard block  | 
                                                    ||
| 2816 | 2816 | $sql .= $hookmanager->resPrint;  | 
                                                        
| 2817 | 2817 | |
| 2818 | 2818 |  		if (count($warehouseStatusArray)) { | 
                                                        
| 2819 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";  | 
                                                        |
| 2820 | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; | 
                                                        |
| 2821 | -			$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. | 
                                                        |
| 2819 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";  | 
                                                        |
| 2820 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; | 
                                                        |
| 2821 | +			$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. | 
                                                        |
| 2822 | 2822 | }  | 
                                                        
| 2823 | 2823 | |
| 2824 | 2824 | // include search in supplier ref  | 
                                                        
| 2825 | 2825 |  		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { | 
                                                        
| 2826 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 2826 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 2827 | 2827 | }  | 
                                                        
| 2828 | 2828 | |
| 2829 | 2829 | //Price by customer  | 
                                                        
| 2830 | 2830 |  		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { | 
                                                        
| 2831 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";  | 
                                                        |
| 2831 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";  | 
                                                        |
| 2832 | 2832 | }  | 
                                                        
| 2833 | 2833 | // Units  | 
                                                        
| 2834 | 2834 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 2835 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 2835 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 2836 | 2836 | }  | 
                                                        
| 2837 | 2837 | // Multilang : we add translation  | 
                                                        
| 2838 | 2838 |  		if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
| 2839 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";  | 
                                                        |
| 2839 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";  | 
                                                        |
| 2840 | 2840 |  			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { | 
                                                        
| 2841 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        |
| 2841 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        |
| 2842 | 2842 | $soc = new Societe($this->db);  | 
                                                        
| 2843 | 2843 | $result = $soc->fetch($socid);  | 
                                                        
| 2844 | 2844 |  				if ($result > 0 && !empty($soc->default_lang)) { | 
                                                        
| 2845 | - $sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";  | 
                                                        |
| 2845 | + $sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";  | 
                                                        |
| 2846 | 2846 |  				} else { | 
                                                        
| 2847 | - $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";  | 
                                                        |
| 2847 | + $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";  | 
                                                        |
| 2848 | 2848 | }  | 
                                                        
| 2849 | 2849 |  			} else { | 
                                                        
| 2850 | - $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";  | 
                                                        |
| 2850 | + $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";  | 
                                                        |
| 2851 | 2851 | }  | 
                                                        
| 2852 | 2852 | }  | 
                                                        
| 2853 | 2853 | |
| 2854 | 2854 |  		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { | 
                                                        
| 2855 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";  | 
                                                        |
| 2855 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";  | 
                                                        |
| 2856 | 2856 | }  | 
                                                        
| 2857 | 2857 | |
| 2858 | -		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; | 
                                                        |
| 2858 | +		$sql .= ' WHERE p.entity IN ('.getEntity('product').')'; | 
                                                        |
| 2859 | 2859 | |
| 2860 | 2860 |  		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { | 
                                                        
| 2861 | 2861 | $sql .= " AND pac.rowid IS NULL";  | 
                                                        
| 2862 | 2862 | }  | 
                                                        
| 2863 | 2863 | |
| 2864 | 2864 |  		if ($finished == 0) { | 
                                                        
| 2865 | - $sql .= " AND p.finished = " . ((int) $finished);  | 
                                                        |
| 2865 | + $sql .= " AND p.finished = ".((int) $finished);  | 
                                                        |
| 2866 | 2866 |  		} elseif ($finished == 1) { | 
                                                        
| 2867 | 2867 | $sql .= " AND p.finished = ".((int) $finished);  | 
                                                        
| 2868 | 2868 | }  | 
                                                        
@@ -2870,11 +2870,11 @@ discard block  | 
                                                    ||
| 2870 | 2870 | $sql .= " AND p.tosell = ".((int) $status);  | 
                                                        
| 2871 | 2871 | }  | 
                                                        
| 2872 | 2872 |  		if ($status_purchase >= 0) { | 
                                                        
| 2873 | - $sql .= " AND p.tobuy = " . ((int) $status_purchase);  | 
                                                        |
| 2873 | + $sql .= " AND p.tobuy = ".((int) $status_purchase);  | 
                                                        |
| 2874 | 2874 | }  | 
                                                        
| 2875 | 2875 | // Filter by product type  | 
                                                        
| 2876 | 2876 |  		if (strval($filtertype) != '') { | 
                                                        
| 2877 | - $sql .= " AND p.fk_product_type = " . ((int) $filtertype);  | 
                                                        |
| 2877 | + $sql .= " AND p.fk_product_type = ".((int) $filtertype);  | 
                                                        |
| 2878 | 2878 |  		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only | 
                                                        
| 2879 | 2879 | $sql .= " AND p.fk_product_type = 1";  | 
                                                        
| 2880 | 2880 |  		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only | 
                                                        
@@ -2898,21 +2898,21 @@ discard block  | 
                                                    ||
| 2898 | 2898 |  				if ($i > 0) { | 
                                                        
| 2899 | 2899 | $sql .= " AND ";  | 
                                                        
| 2900 | 2900 | }  | 
                                                        
| 2901 | - $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2901 | + $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2902 | 2902 |  				if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
| 2903 | - $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2903 | + $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2904 | 2904 | }  | 
                                                        
| 2905 | 2905 |  				if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { | 
                                                        
| 2906 | - $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2906 | + $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2907 | 2907 | }  | 
                                                        
| 2908 | 2908 |  				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { | 
                                                        
| 2909 | - $sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2909 | + $sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2910 | 2910 |  					if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
| 2911 | - $sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2911 | + $sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2912 | 2912 | }  | 
                                                        
| 2913 | 2913 | }  | 
                                                        
| 2914 | 2914 |  				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { | 
                                                        
| 2915 | - $sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2915 | + $sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2916 | 2916 | }  | 
                                                        
| 2917 | 2917 | $sql .= ")";  | 
                                                        
| 2918 | 2918 | $i++;  | 
                                                        
@@ -2921,12 +2921,12 @@ discard block  | 
                                                    ||
| 2921 | 2921 | $sql .= ")";  | 
                                                        
| 2922 | 2922 | }  | 
                                                        
| 2923 | 2923 |  			if (isModEnabled('barcode')) { | 
                                                        
| 2924 | - $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 2924 | + $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 2925 | 2925 | }  | 
                                                        
| 2926 | 2926 | $sql .= ')';  | 
                                                        
| 2927 | 2927 | }  | 
                                                        
| 2928 | 2928 |  		if (count($warehouseStatusArray)) { | 
                                                        
| 2929 | - $sql .= " GROUP BY " . $selectFields;  | 
                                                        |
| 2929 | + $sql .= " GROUP BY ".$selectFields;  | 
                                                        |
| 2930 | 2930 | }  | 
                                                        
| 2931 | 2931 | |
| 2932 | 2932 | //Sort by category  | 
                                                        
@@ -2941,23 +2941,23 @@ discard block  | 
                                                    ||
| 2941 | 2941 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 2942 | 2942 | |
| 2943 | 2943 | // Build output string  | 
                                                        
| 2944 | - dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);  | 
                                                        |
| 2944 | + dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);  | 
                                                        |
| 2945 | 2945 | $result = $this->db->query($sql);  | 
                                                        
| 2946 | 2946 |  		if ($result) { | 
                                                        
| 2947 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 2948 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 2949 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';  | 
                                                        |
| 2947 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 2948 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 2949 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';  | 
                                                        |
| 2950 | 2950 | |
| 2951 | 2951 | $num = $this->db->num_rows($result);  | 
                                                        
| 2952 | 2952 | |
| 2953 | 2953 | $events = null;  | 
                                                        
| 2954 | 2954 | |
| 2955 | 2955 |  			if (!$forcecombo) { | 
                                                        
| 2956 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 2956 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 2957 | 2957 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); | 
                                                        
| 2958 | 2958 | }  | 
                                                        
| 2959 | 2959 | |
| 2960 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 2960 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 2961 | 2961 | |
| 2962 | 2962 | $textifempty = '';  | 
                                                        
| 2963 | 2963 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -2974,7 +2974,7 @@ discard block  | 
                                                    ||
| 2974 | 2974 | }  | 
                                                        
| 2975 | 2975 | }  | 
                                                        
| 2976 | 2976 |  			if ($showempty) { | 
                                                        
| 2977 | - $out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>';  | 
                                                        |
| 2977 | + $out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>';  | 
                                                        |
| 2978 | 2978 | }  | 
                                                        
| 2979 | 2979 | |
| 2980 | 2980 | $i = 0;  | 
                                                        
@@ -2985,11 +2985,11 @@ discard block  | 
                                                    ||
| 2985 | 2985 | |
| 2986 | 2986 |  				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 | 
                                                        
| 2987 | 2987 | $sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";  | 
                                                        
| 2988 | - $sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";  | 
                                                        |
| 2989 | - $sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);  | 
                                                        |
| 2988 | + $sql .= " FROM ".$this->db->prefix()."product_price_by_qty";  | 
                                                        |
| 2989 | + $sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);  | 
                                                        |
| 2990 | 2990 | $sql .= " ORDER BY quantity ASC";  | 
                                                        
| 2991 | 2991 | |
| 2992 | - dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);  | 
                                                        |
| 2992 | + dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);  | 
                                                        |
| 2993 | 2993 | $result2 = $this->db->query($sql);  | 
                                                        
| 2994 | 2994 |  					if ($result2) { | 
                                                        
| 2995 | 2995 | $nb_prices = $this->db->num_rows($result2);  | 
                                                        
@@ -3027,7 +3027,7 @@ discard block  | 
                                                    ||
| 3027 | 3027 | $price_product = new Product($this->db);  | 
                                                        
| 3028 | 3028 | $price_product->fetch($objp->rowid, '', '', 1);  | 
                                                        
| 3029 | 3029 | |
| 3030 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3030 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3031 | 3031 | $priceparser = new PriceParser($this->db);  | 
                                                        
| 3032 | 3032 | $price_result = $priceparser->parseProduct($price_product);  | 
                                                        
| 3033 | 3033 |  						if ($price_result >= 0) { | 
                                                        
@@ -3111,7 +3111,7 @@ discard block  | 
                                                    ||
| 3111 | 3111 | $label = $objp->label_translated;  | 
                                                        
| 3112 | 3112 | }  | 
                                                        
| 3113 | 3113 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 3114 | -			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3114 | +			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3115 | 3115 | }  | 
                                                        
| 3116 | 3116 | |
| 3117 | 3117 | $outkey = $objp->rowid;  | 
                                                        
@@ -3132,32 +3132,32 @@ discard block  | 
                                                    ||
| 3132 | 3132 | $outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';  | 
                                                        
| 3133 | 3133 | |
| 3134 | 3134 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
| 3135 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 3135 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 3136 | 3136 | }  | 
                                                        
| 3137 | 3137 | |
| 3138 | 3138 | // Units  | 
                                                        
| 3139 | 3139 | $outvalUnits = '';  | 
                                                        
| 3140 | 3140 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3141 | 3141 |  			if (!empty($objp->unit_short)) { | 
                                                        
| 3142 | - $outvalUnits .= ' - ' . $objp->unit_short;  | 
                                                        |
| 3142 | + $outvalUnits .= ' - '.$objp->unit_short;  | 
                                                        |
| 3143 | 3143 | }  | 
                                                        
| 3144 | 3144 | }  | 
                                                        
| 3145 | 3145 |  		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { | 
                                                        
| 3146 | 3146 |  			if (!empty($objp->weight) && $objp->weight_units !== null) { | 
                                                        
| 3147 | 3147 | $unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);  | 
                                                        
| 3148 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3148 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3149 | 3149 | }  | 
                                                        
| 3150 | 3150 |  			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { | 
                                                        
| 3151 | - $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3152 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3151 | + $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3152 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3153 | 3153 | }  | 
                                                        
| 3154 | 3154 |  			if (!empty($objp->surface) && $objp->surface_units !== null) { | 
                                                        
| 3155 | 3155 | $unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);  | 
                                                        
| 3156 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3156 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3157 | 3157 | }  | 
                                                        
| 3158 | 3158 |  			if (!empty($objp->volume) && $objp->volume_units !== null) { | 
                                                        
| 3159 | 3159 | $unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);  | 
                                                        
| 3160 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3160 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3161 | 3161 | }  | 
                                                        
| 3162 | 3162 | }  | 
                                                        
| 3163 | 3163 |  		if ($outdurationvalue && $outdurationunit) { | 
                                                        
@@ -3169,14 +3169,14 @@ discard block  | 
                                                    ||
| 3169 | 3169 |  				'y' => $langs->trans('Year') | 
                                                        
| 3170 | 3170 | );  | 
                                                        
| 3171 | 3171 |  			if (isset($da[$outdurationunit])) { | 
                                                        
| 3172 | - $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3172 | + $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3173 | 3173 | }  | 
                                                        
| 3174 | 3174 | }  | 
                                                        
| 3175 | 3175 | |
| 3176 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 3176 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 3177 | 3177 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 3178 | 3178 |  		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { | 
                                                        
| 3179 | - $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 . '"';  | 
                                                        |
| 3179 | + $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.'"';  | 
                                                        |
| 3180 | 3180 | }  | 
                                                        
| 3181 | 3181 |  		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                        
| 3182 | 3182 |  			if ($user->hasRight('stock', 'lire')) { | 
                                                        
@@ -3188,36 +3188,36 @@ discard block  | 
                                                    ||
| 3188 | 3188 | }  | 
                                                        
| 3189 | 3189 | }  | 
                                                        
| 3190 | 3190 |  		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { | 
                                                        
| 3191 | - $opt .= ' data-labeltrans="' . $outlabel_translated . '"';  | 
                                                        |
| 3192 | - $opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';  | 
                                                        |
| 3191 | + $opt .= ' data-labeltrans="'.$outlabel_translated.'"';  | 
                                                        |
| 3192 | + $opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';  | 
                                                        |
| 3193 | 3193 | }  | 
                                                        
| 3194 | 3194 | $opt .= '>';  | 
                                                        
| 3195 | 3195 | $opt .= $objp->ref;  | 
                                                        
| 3196 | 3196 |  		if (!empty($objp->custref)) { | 
                                                        
| 3197 | -			$opt .= ' (' . $objp->custref . ')'; | 
                                                        |
| 3197 | +			$opt .= ' ('.$objp->custref.')'; | 
                                                        |
| 3198 | 3198 | }  | 
                                                        
| 3199 | 3199 |  		if ($outbarcode) { | 
                                                        
| 3200 | -			$opt .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3200 | +			$opt .= ' ('.$outbarcode.')'; | 
                                                        |
| 3201 | 3201 | }  | 
                                                        
| 3202 | - $opt .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3202 | + $opt .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3203 | 3203 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
| 3204 | -			$opt .= ' (' . getCountry($outorigin, 1) . ')'; | 
                                                        |
| 3204 | +			$opt .= ' ('.getCountry($outorigin, 1).')'; | 
                                                        |
| 3205 | 3205 | }  | 
                                                        
| 3206 | 3206 | |
| 3207 | 3207 | $objRef = $objp->ref;  | 
                                                        
| 3208 | 3208 |  		if (!empty($objp->custref)) { | 
                                                        
| 3209 | -			$objRef .= ' (' . $objp->custref . ')'; | 
                                                        |
| 3209 | +			$objRef .= ' ('.$objp->custref.')'; | 
                                                        |
| 3210 | 3210 | }  | 
                                                        
| 3211 | 3211 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 3212 | -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3212 | +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3213 | 3213 | }  | 
                                                        
| 3214 | 3214 | $outval .= $objRef;  | 
                                                        
| 3215 | 3215 |  		if ($outbarcode) { | 
                                                        
| 3216 | -			$outval .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3216 | +			$outval .= ' ('.$outbarcode.')'; | 
                                                        |
| 3217 | 3217 | }  | 
                                                        
| 3218 | - $outval .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3218 | + $outval .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3219 | 3219 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
| 3220 | -			$outval .= ' (' . getCountry($outorigin, 1) . ')'; | 
                                                        |
| 3220 | +			$outval .= ' ('.getCountry($outorigin, 1).')'; | 
                                                        |
| 3221 | 3221 | }  | 
                                                        
| 3222 | 3222 | |
| 3223 | 3223 | // Units  | 
                                                        
@@ -3230,35 +3230,35 @@ discard block  | 
                                                    ||
| 3230 | 3230 | // If we need a particular price level (from 1 to n)  | 
                                                        
| 3231 | 3231 |  		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { | 
                                                        
| 3232 | 3232 | $sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";  | 
                                                        
| 3233 | - $sql .= " FROM " . $this->db->prefix() . "product_price";  | 
                                                        |
| 3234 | - $sql .= " WHERE fk_product = " . ((int) $objp->rowid);  | 
                                                        |
| 3235 | -			$sql .= " AND entity IN (" . getEntity('productprice') . ")"; | 
                                                        |
| 3236 | - $sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        |
| 3233 | + $sql .= " FROM ".$this->db->prefix()."product_price";  | 
                                                        |
| 3234 | + $sql .= " WHERE fk_product = ".((int) $objp->rowid);  | 
                                                        |
| 3235 | +			$sql .= " AND entity IN (".getEntity('productprice').")"; | 
                                                        |
| 3236 | + $sql .= " AND price_level = ".((int) $price_level);  | 
                                                        |
| 3237 | 3237 | $sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.  | 
                                                        
| 3238 | 3238 | $sql .= " LIMIT 1";  | 
                                                        
| 3239 | 3239 | |
| 3240 | - dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG);  | 
                                                        |
| 3240 | + dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);  | 
                                                        |
| 3241 | 3241 | $result2 = $this->db->query($sql);  | 
                                                        
| 3242 | 3242 |  			if ($result2) { | 
                                                        
| 3243 | 3243 | $objp2 = $this->db->fetch_object($result2);  | 
                                                        
| 3244 | 3244 |  				if ($objp2) { | 
                                                        
| 3245 | 3245 | $found = 1;  | 
                                                        
| 3246 | 3246 |  					if ($objp2->price_base_type == 'HT') { | 
                                                        
| 3247 | -						$opt .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        |
| 3248 | -						$outval .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        |
| 3247 | +						$opt .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        |
| 3248 | +						$outval .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        |
| 3249 | 3249 |  					} else { | 
                                                        
| 3250 | -						$opt .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        |
| 3251 | -						$outval .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        |
| 3250 | +						$opt .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        |
| 3251 | +						$outval .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        |
| 3252 | 3252 | }  | 
                                                        
| 3253 | 3253 | $outprice_ht = price($objp2->price);  | 
                                                        
| 3254 | 3254 | $outprice_ttc = price($objp2->price_ttc);  | 
                                                        
| 3255 | 3255 | $outpricebasetype = $objp2->price_base_type;  | 
                                                        
| 3256 | 3256 |  					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility | 
                                                        
| 3257 | - $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice  | 
                                                        |
| 3258 | - $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice  | 
                                                        |
| 3257 | + $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice  | 
                                                        |
| 3258 | + $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice  | 
                                                        |
| 3259 | 3259 |  					} else { | 
                                                        
| 3260 | - $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice  | 
                                                        |
| 3261 | - $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice  | 
                                                        |
| 3260 | + $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice  | 
                                                        |
| 3261 | + $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice  | 
                                                        |
| 3262 | 3262 | }  | 
                                                        
| 3263 | 3263 | }  | 
                                                        
| 3264 | 3264 |  			} else { | 
                                                        
@@ -3272,13 +3272,13 @@ discard block  | 
                                                    ||
| 3272 | 3272 | $outqty = $objp->quantity;  | 
                                                        
| 3273 | 3273 | $outdiscount = $objp->remise_percent;  | 
                                                        
| 3274 | 3274 |  			if ($objp->quantity == 1) { | 
                                                        
| 3275 | - $opt .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/";  | 
                                                        |
| 3276 | - $outval .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/";  | 
                                                        |
| 3275 | + $opt .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/";  | 
                                                        |
| 3276 | + $outval .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/";  | 
                                                        |
| 3277 | 3277 |  				$opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
| 3278 | 3278 |  				$outval .= $langs->transnoentities("Unit"); | 
                                                        
| 3279 | 3279 |  			} else { | 
                                                        
| 3280 | - $opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;  | 
                                                        |
| 3281 | - $outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;  | 
                                                        |
| 3280 | + $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;  | 
                                                        |
| 3281 | + $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;  | 
                                                        |
| 3282 | 3282 |  				$opt .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
| 3283 | 3283 |  				$outval .= $langs->transnoentities("Units"); | 
                                                        
| 3284 | 3284 | }  | 
                                                        
@@ -3286,16 +3286,16 @@ discard block  | 
                                                    ||
| 3286 | 3286 | $outprice_ht = price($objp->unitprice);  | 
                                                        
| 3287 | 3287 | $outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));  | 
                                                        
| 3288 | 3288 | $outpricebasetype = $objp->price_base_type;  | 
                                                        
| 3289 | - $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  | 
                                                        |
| 3290 | - $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  | 
                                                        |
| 3289 | + $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  | 
                                                        |
| 3290 | + $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  | 
                                                        |
| 3291 | 3291 | }  | 
                                                        
| 3292 | 3292 |  		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { | 
                                                        
| 3293 | -			$opt .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3294 | -			$outval .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3293 | +			$opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3294 | +			$outval .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3295 | 3295 | }  | 
                                                        
| 3296 | 3296 |  		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { | 
                                                        
| 3297 | -			$opt .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3298 | -			$outval .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3297 | +			$opt .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3298 | +			$outval .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3299 | 3299 | }  | 
                                                        
| 3300 | 3300 | |
| 3301 | 3301 | // Price by customer  | 
                                                        
@@ -3304,11 +3304,11 @@ discard block  | 
                                                    ||
| 3304 | 3304 | $found = 1;  | 
                                                        
| 3305 | 3305 | |
| 3306 | 3306 |  				if ($objp->custprice_base_type == 'HT') { | 
                                                        
| 3307 | -					$opt .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        |
| 3308 | -					$outval .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        |
| 3307 | +					$opt .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        |
| 3308 | +					$outval .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        |
| 3309 | 3309 |  				} else { | 
                                                        
| 3310 | -					$opt .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        |
| 3311 | -					$outval .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        |
| 3310 | +					$opt .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        |
| 3311 | +					$outval .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        |
| 3312 | 3312 | }  | 
                                                        
| 3313 | 3313 | |
| 3314 | 3314 | $outprice_ht = price($objp->custprice);  | 
                                                        
@@ -3322,11 +3322,11 @@ discard block  | 
                                                    ||
| 3322 | 3322 | // If level no defined or multiprice not found, we used the default price  | 
                                                        
| 3323 | 3323 |  		if (empty($hidepriceinlabel) && !$found) { | 
                                                        
| 3324 | 3324 |  			if ($objp->price_base_type == 'HT') { | 
                                                        
| 3325 | -				$opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        |
| 3326 | -				$outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        |
| 3325 | +				$opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        |
| 3326 | +				$outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        |
| 3327 | 3327 |  			} else { | 
                                                        
| 3328 | -				$opt .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        |
| 3329 | -				$outval .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        |
| 3328 | +				$opt .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        |
| 3329 | +				$outval .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        |
| 3330 | 3330 | }  | 
                                                        
| 3331 | 3331 | $outprice_ht = price($objp->price);  | 
                                                        
| 3332 | 3332 | $outprice_ttc = price($objp->price_ttc);  | 
                                                        
@@ -3337,14 +3337,14 @@ discard block  | 
                                                    ||
| 3337 | 3337 | |
| 3338 | 3338 |  		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                        
| 3339 | 3339 |  			if ($user->hasRight('stock', 'lire')) { | 
                                                        
| 3340 | -				$opt .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3340 | +				$opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3341 | 3341 | |
| 3342 | 3342 |  				if ($objp->stock > 0) { | 
                                                        
| 3343 | 3343 | $outval .= ' - <span class="product_line_stock_ok">';  | 
                                                        
| 3344 | 3344 |  				} elseif ($objp->stock <= 0) { | 
                                                        
| 3345 | 3345 | $outval .= ' - <span class="product_line_stock_too_low">';  | 
                                                        
| 3346 | 3346 | }  | 
                                                        
| 3347 | -				$outval .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3347 | +				$outval .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3348 | 3348 | $outval .= '</span>';  | 
                                                        
| 3349 | 3349 |  				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation | 
                                                        
| 3350 | 3350 |  					$langs->load("stocks"); | 
                                                        
@@ -3354,9 +3354,9 @@ discard block  | 
                                                    ||
| 3354 | 3354 | $tmpproduct->load_virtual_stock();  | 
                                                        
| 3355 | 3355 | $virtualstock = $tmpproduct->stock_theorique;  | 
                                                        
| 3356 | 3356 | |
| 3357 | -					$opt .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; | 
                                                        |
| 3357 | +					$opt .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; | 
                                                        |
| 3358 | 3358 | |
| 3359 | -					$outval .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; | 
                                                        |
| 3359 | +					$outval .= ' - '.$langs->transnoentities("VirtualStock").':'; | 
                                                        |
| 3360 | 3360 |  					if ($virtualstock > 0) { | 
                                                        
| 3361 | 3361 | $outval .= '<span class="product_line_stock_ok">';  | 
                                                        
| 3362 | 3362 |  					} elseif ($virtualstock <= 0) { | 
                                                        
@@ -3434,7 +3434,7 @@ discard block  | 
                                                    ||
| 3434 | 3434 | $selected_input_value = '';  | 
                                                        
| 3435 | 3435 |  		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { | 
                                                        
| 3436 | 3436 |  			if ($selected > 0) { | 
                                                        
| 3437 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 3437 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 3438 | 3438 | $producttmpselect = new Product($this->db);  | 
                                                        
| 3439 | 3439 | $producttmpselect->fetch($selected);  | 
                                                        
| 3440 | 3440 | $selected_input_value = $producttmpselect->ref;  | 
                                                        
@@ -3442,10 +3442,10 @@ discard block  | 
                                                    ||
| 3442 | 3442 | }  | 
                                                        
| 3443 | 3443 | |
| 3444 | 3444 | // mode=2 means suppliers products  | 
                                                        
| 3445 | - $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;  | 
                                                        |
| 3446 | - print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);  | 
                                                        |
| 3445 | + $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;  | 
                                                        |
| 3446 | + print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);  | 
                                                        |
| 3447 | 3447 | |
| 3448 | -			print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="minwidth300" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; | 
                                                        |
| 3448 | +			print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="minwidth300" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; | 
                                                        |
| 3449 | 3449 |  		} else { | 
                                                        
| 3450 | 3450 | print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);  | 
                                                        
| 3451 | 3451 | }  | 
                                                        
@@ -3505,25 +3505,25 @@ discard block  | 
                                                    ||
| 3505 | 3505 |  		if (isModEnabled('barcode')) { | 
                                                        
| 3506 | 3506 | $sql .= ", pfp.barcode";  | 
                                                        
| 3507 | 3507 | }  | 
                                                        
| 3508 | - $sql .= " FROM " . $this->db->prefix() . "product as p";  | 
                                                        |
| 3509 | -		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; | 
                                                        |
| 3508 | + $sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        |
| 3509 | +		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; | 
                                                        |
| 3510 | 3510 |  		if ($socid > 0) { | 
                                                        
| 3511 | - $sql .= " AND pfp.fk_soc = " . ((int) $socid);  | 
                                                        |
| 3511 | + $sql .= " AND pfp.fk_soc = ".((int) $socid);  | 
                                                        |
| 3512 | 3512 | }  | 
                                                        
| 3513 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3513 | + $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3514 | 3514 | // Units  | 
                                                        
| 3515 | 3515 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3516 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 3516 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 3517 | 3517 | }  | 
                                                        
| 3518 | -		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; | 
                                                        |
| 3518 | +		$sql .= " WHERE p.entity IN (".getEntity('product').")"; | 
                                                        |
| 3519 | 3519 |  		if ($statut != -1) { | 
                                                        
| 3520 | - $sql .= " AND p.tobuy = " . ((int) $statut);  | 
                                                        |
| 3520 | + $sql .= " AND p.tobuy = ".((int) $statut);  | 
                                                        |
| 3521 | 3521 | }  | 
                                                        
| 3522 | 3522 |  		if (strval($filtertype) != '') { | 
                                                        
| 3523 | - $sql .= " AND p.fk_product_type = " . ((int) $filtertype);  | 
                                                        |
| 3523 | + $sql .= " AND p.fk_product_type = ".((int) $filtertype);  | 
                                                        |
| 3524 | 3524 | }  | 
                                                        
| 3525 | 3525 |  		if (!empty($filtre)) { | 
                                                        
| 3526 | - $sql .= " " . $filtre;  | 
                                                        |
| 3526 | + $sql .= " ".$filtre;  | 
                                                        |
| 3527 | 3527 | }  | 
                                                        
| 3528 | 3528 | // Add where from hooks  | 
                                                        
| 3529 | 3529 | $parameters = array();  | 
                                                        
@@ -3543,9 +3543,9 @@ discard block  | 
                                                    ||
| 3543 | 3543 |  				if ($i > 0) { | 
                                                        
| 3544 | 3544 | $sql .= " AND ";  | 
                                                        
| 3545 | 3545 | }  | 
                                                        
| 3546 | - $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) . "%'";  | 
                                                        |
| 3546 | + $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)."%'";  | 
                                                        |
| 3547 | 3547 |  				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { | 
                                                        
| 3548 | - $sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 3548 | + $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 3549 | 3549 | }  | 
                                                        
| 3550 | 3550 | $sql .= ")";  | 
                                                        
| 3551 | 3551 | $i++;  | 
                                                        
@@ -3554,8 +3554,8 @@ discard block  | 
                                                    ||
| 3554 | 3554 | $sql .= ")";  | 
                                                        
| 3555 | 3555 | }  | 
                                                        
| 3556 | 3556 |  			if (isModEnabled('barcode')) { | 
                                                        
| 3557 | - $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 3558 | - $sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 3557 | + $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 3558 | + $sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 3559 | 3559 | }  | 
                                                        
| 3560 | 3560 | $sql .= ')';  | 
                                                        
| 3561 | 3561 | }  | 
                                                        
@@ -3564,20 +3564,20 @@ discard block  | 
                                                    ||
| 3564 | 3564 | |
| 3565 | 3565 | // Build output string  | 
                                                        
| 3566 | 3566 | |
| 3567 | - dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);  | 
                                                        |
| 3567 | + dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);  | 
                                                        |
| 3568 | 3568 | $result = $this->db->query($sql);  | 
                                                        
| 3569 | 3569 |  		if ($result) { | 
                                                        
| 3570 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3571 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';  | 
                                                        |
| 3570 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3571 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';  | 
                                                        |
| 3572 | 3572 | |
| 3573 | 3573 | $num = $this->db->num_rows($result);  | 
                                                        
| 3574 | 3574 | |
| 3575 | 3575 | //$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax  | 
                                                        
| 3576 | - $out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 3576 | + $out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 3577 | 3577 |  			if (!$selected) { | 
                                                        
| 3578 | - $out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>';  | 
                                                        |
| 3578 | + $out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>';  | 
                                                        |
| 3579 | 3579 |  			} else { | 
                                                        
| 3580 | - $out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>';  | 
                                                        |
| 3580 | + $out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>';  | 
                                                        |
| 3581 | 3581 | }  | 
                                                        
| 3582 | 3582 | |
| 3583 | 3583 | $i = 0;  | 
                                                        
@@ -3592,7 +3592,7 @@ discard block  | 
                                                    ||
| 3592 | 3592 | |
| 3593 | 3593 | $outkey = $objp->idprodfournprice; // id in table of price  | 
                                                        
| 3594 | 3594 |  				if (!$outkey && $alsoproductwithnosupplierprice) { | 
                                                        
| 3595 | - $outkey = 'idprod_' . $objp->rowid; // id of product  | 
                                                        |
| 3595 | + $outkey = 'idprod_'.$objp->rowid; // id of product  | 
                                                        |
| 3596 | 3596 | }  | 
                                                        
| 3597 | 3597 | |
| 3598 | 3598 | $outref = $objp->ref;  | 
                                                        
@@ -3607,23 +3607,23 @@ discard block  | 
                                                    ||
| 3607 | 3607 | $outvalUnits = '';  | 
                                                        
| 3608 | 3608 |  				if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3609 | 3609 |  					if (!empty($objp->unit_short)) { | 
                                                        
| 3610 | - $outvalUnits .= ' - ' . $objp->unit_short;  | 
                                                        |
| 3610 | + $outvalUnits .= ' - '.$objp->unit_short;  | 
                                                        |
| 3611 | 3611 | }  | 
                                                        
| 3612 | 3612 |  					if (!empty($objp->weight) && $objp->weight_units !== null) { | 
                                                        
| 3613 | 3613 | $unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);  | 
                                                        
| 3614 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3614 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3615 | 3615 | }  | 
                                                        
| 3616 | 3616 |  					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { | 
                                                        
| 3617 | - $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3618 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3617 | + $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3618 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3619 | 3619 | }  | 
                                                        
| 3620 | 3620 |  					if (!empty($objp->surface) && $objp->surface_units !== null) { | 
                                                        
| 3621 | 3621 | $unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);  | 
                                                        
| 3622 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3622 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3623 | 3623 | }  | 
                                                        
| 3624 | 3624 |  					if (!empty($objp->volume) && $objp->volume_units !== null) { | 
                                                        
| 3625 | 3625 | $unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);  | 
                                                        
| 3626 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3626 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3627 | 3627 | }  | 
                                                        
| 3628 | 3628 |  					if ($outdurationvalue && $outdurationunit) { | 
                                                        
| 3629 | 3629 | $da = array(  | 
                                                        
@@ -3634,22 +3634,22 @@ discard block  | 
                                                    ||
| 3634 | 3634 |  							'y' => $langs->trans('Year') | 
                                                        
| 3635 | 3635 | );  | 
                                                        
| 3636 | 3636 |  						if (isset($da[$outdurationunit])) { | 
                                                        
| 3637 | - $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3637 | + $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3638 | 3638 | }  | 
                                                        
| 3639 | 3639 | }  | 
                                                        
| 3640 | 3640 | }  | 
                                                        
| 3641 | 3641 | |
| 3642 | 3642 | $objRef = $objp->ref;  | 
                                                        
| 3643 | 3643 |  				if ($filterkey && $filterkey != '') { | 
                                                        
| 3644 | -					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3644 | +					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3645 | 3645 | }  | 
                                                        
| 3646 | 3646 | $objRefFourn = $objp->ref_fourn;  | 
                                                        
| 3647 | 3647 |  				if ($filterkey && $filterkey != '') { | 
                                                        
| 3648 | -					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); | 
                                                        |
| 3648 | +					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); | 
                                                        |
| 3649 | 3649 | }  | 
                                                        
| 3650 | 3650 | $label = $objp->label;  | 
                                                        
| 3651 | 3651 |  				if ($filterkey && $filterkey != '') { | 
                                                        
| 3652 | -					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3652 | +					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3653 | 3653 | }  | 
                                                        
| 3654 | 3654 | |
| 3655 | 3655 |  				switch ($objp->fk_product_type) { | 
                                                        
@@ -3672,21 +3672,21 @@ discard block  | 
                                                    ||
| 3672 | 3672 | |
| 3673 | 3673 | $optlabel .= $objp->ref;  | 
                                                        
| 3674 | 3674 |  				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { | 
                                                        
| 3675 | -					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; | 
                                                        |
| 3675 | +					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; | 
                                                        |
| 3676 | 3676 | }  | 
                                                        
| 3677 | 3677 |  				if (isModEnabled('barcode') && !empty($objp->barcode)) { | 
                                                        
| 3678 | -					$optlabel .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3678 | +					$optlabel .= ' ('.$outbarcode.')'; | 
                                                        |
| 3679 | 3679 | }  | 
                                                        
| 3680 | - $optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3680 | + $optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3681 | 3681 | |
| 3682 | 3682 | $outvallabel = $objRef;  | 
                                                        
| 3683 | 3683 |  				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { | 
                                                        
| 3684 | -					$outvallabel .= ' (' . $objRefFourn . ')'; | 
                                                        |
| 3684 | +					$outvallabel .= ' ('.$objRefFourn.')'; | 
                                                        |
| 3685 | 3685 | }  | 
                                                        
| 3686 | 3686 |  				if (isModEnabled('barcode') && !empty($objp->barcode)) { | 
                                                        
| 3687 | -					$outvallabel .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3687 | +					$outvallabel .= ' ('.$outbarcode.')'; | 
                                                        |
| 3688 | 3688 | }  | 
                                                        
| 3689 | - $outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3689 | + $outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3690 | 3690 | |
| 3691 | 3691 | // Units  | 
                                                        
| 3692 | 3692 | $optlabel .= $outvalUnits;  | 
                                                        
@@ -3703,7 +3703,7 @@ discard block  | 
                                                    ||
| 3703 | 3703 | $prod_supplier->fourn_tva_tx = $objp->tva_tx;  | 
                                                        
| 3704 | 3704 | $prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;  | 
                                                        
| 3705 | 3705 | |
| 3706 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3706 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3707 | 3707 | $priceparser = new PriceParser($this->db);  | 
                                                        
| 3708 | 3708 | $price_result = $priceparser->parseProductSupplier($prod_supplier);  | 
                                                        
| 3709 | 3709 |  						if ($price_result >= 0) { | 
                                                        
@@ -3714,47 +3714,47 @@ discard block  | 
                                                    ||
| 3714 | 3714 | }  | 
                                                        
| 3715 | 3715 | }  | 
                                                        
| 3716 | 3716 |  					if ($objp->quantity == 1) { | 
                                                        
| 3717 | -						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        |
| 3718 | -						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        |
| 3717 | +						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        |
| 3718 | +						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        |
| 3719 | 3719 |  						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
| 3720 | 3720 |  						$outvallabel .= $langs->transnoentities("Unit"); | 
                                                        
| 3721 | 3721 |  					} else { | 
                                                        
| 3722 | -						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                        |
| 3723 | -						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                        |
| 3724 | -						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3725 | -						$outvallabel .= ' ' . $langs->transnoentities("Units"); | 
                                                        |
| 3722 | +						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                        |
| 3723 | +						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                        |
| 3724 | +						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3725 | +						$outvallabel .= ' '.$langs->transnoentities("Units"); | 
                                                        |
| 3726 | 3726 | }  | 
                                                        
| 3727 | 3727 | |
| 3728 | 3728 |  					if ($objp->quantity > 1) { | 
                                                        
| 3729 | -						$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 | 
                                                        |
| 3730 | -						$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 | 
                                                        |
| 3729 | +						$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 | 
                                                        |
| 3730 | +						$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 | 
                                                        |
| 3731 | 3731 | }  | 
                                                        
| 3732 | 3732 |  					if ($objp->remise_percent >= 1) { | 
                                                        
| 3733 | -						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3734 | -						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3733 | +						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3734 | +						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3735 | 3735 | }  | 
                                                        
| 3736 | 3736 |  					if ($objp->duration) { | 
                                                        
| 3737 | - $optlabel .= " - " . $objp->duration;  | 
                                                        |
| 3738 | - $outvallabel .= " - " . $objp->duration;  | 
                                                        |
| 3737 | + $optlabel .= " - ".$objp->duration;  | 
                                                        |
| 3738 | + $outvallabel .= " - ".$objp->duration;  | 
                                                        |
| 3739 | 3739 | }  | 
                                                        
| 3740 | 3740 |  					if (!$socid) { | 
                                                        
| 3741 | - $optlabel .= " - " . dol_trunc($objp->name, 8);  | 
                                                        |
| 3742 | - $outvallabel .= " - " . dol_trunc($objp->name, 8);  | 
                                                        |
| 3741 | + $optlabel .= " - ".dol_trunc($objp->name, 8);  | 
                                                        |
| 3742 | + $outvallabel .= " - ".dol_trunc($objp->name, 8);  | 
                                                        |
| 3743 | 3743 | }  | 
                                                        
| 3744 | 3744 |  					if ($objp->supplier_reputation) { | 
                                                        
| 3745 | 3745 | //TODO dictionary  | 
                                                        
| 3746 | 3746 |  						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); | 
                                                        
| 3747 | 3747 | |
| 3748 | - $optlabel .= " - " . $reputations[$objp->supplier_reputation];  | 
                                                        |
| 3749 | - $outvallabel .= " - " . $reputations[$objp->supplier_reputation];  | 
                                                        |
| 3748 | + $optlabel .= " - ".$reputations[$objp->supplier_reputation];  | 
                                                        |
| 3749 | + $outvallabel .= " - ".$reputations[$objp->supplier_reputation];  | 
                                                        |
| 3750 | 3750 | }  | 
                                                        
| 3751 | 3751 |  				} else { | 
                                                        
| 3752 | 3752 |  					if (empty($alsoproductwithnosupplierprice)) {     // No supplier price defined for couple product/supplier | 
                                                        
| 3753 | -						$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; | 
                                                        |
| 3754 | -						$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                        |
| 3753 | +						$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; | 
                                                        |
| 3754 | +						$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                        |
| 3755 | 3755 |  					} else { // No supplier price defined for product, even on other suppliers | 
                                                        
| 3756 | -						$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; | 
                                                        |
| 3757 | -						$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                        |
| 3756 | +						$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; | 
                                                        |
| 3757 | +						$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                        |
| 3758 | 3758 | }  | 
                                                        
| 3759 | 3759 | }  | 
                                                        
| 3760 | 3760 | |
@@ -3762,14 +3762,14 @@ discard block  | 
                                                    ||
| 3762 | 3762 | $novirtualstock = ($showstockinlist == 2);  | 
                                                        
| 3763 | 3763 | |
| 3764 | 3764 |  					if ($user->hasRight('stock', 'lire')) { | 
                                                        
| 3765 | -						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3765 | +						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3766 | 3766 | |
| 3767 | 3767 |  						if ($objp->stock > 0) { | 
                                                        
| 3768 | 3768 | $optlabel .= ' - <span class="product_line_stock_ok">';  | 
                                                        
| 3769 | 3769 |  						} elseif ($objp->stock <= 0) { | 
                                                        
| 3770 | 3770 | $optlabel .= ' - <span class="product_line_stock_too_low">';  | 
                                                        
| 3771 | 3771 | }  | 
                                                        
| 3772 | -						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3772 | +						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3773 | 3773 | $optlabel .= '</span>';  | 
                                                        
| 3774 | 3774 |  						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation | 
                                                        
| 3775 | 3775 |  							$langs->load("stocks"); | 
                                                        
@@ -3779,9 +3779,9 @@ discard block  | 
                                                    ||
| 3779 | 3779 | $tmpproduct->load_virtual_stock();  | 
                                                        
| 3780 | 3780 | $virtualstock = $tmpproduct->stock_theorique;  | 
                                                        
| 3781 | 3781 | |
| 3782 | -							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; | 
                                                        |
| 3782 | +							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; | 
                                                        |
| 3783 | 3783 | |
| 3784 | -							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; | 
                                                        |
| 3784 | +							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; | 
                                                        |
| 3785 | 3785 |  							if ($virtualstock > 0) { | 
                                                        
| 3786 | 3786 | $optlabel .= '<span class="product_line_stock_ok">';  | 
                                                        
| 3787 | 3787 |  							} elseif ($virtualstock <= 0) { | 
                                                        
@@ -3795,7 +3795,7 @@ discard block  | 
                                                    ||
| 3795 | 3795 | }  | 
                                                        
| 3796 | 3796 | }  | 
                                                        
| 3797 | 3797 | |
| 3798 | - $optstart = '<option value="' . $outkey . '"';  | 
                                                        |
| 3798 | + $optstart = '<option value="'.$outkey.'"';  | 
                                                        |
| 3799 | 3799 |  				if ($selected && $selected == $objp->idprodfournprice) { | 
                                                        
| 3800 | 3800 | $optstart .= ' selected';  | 
                                                        
| 3801 | 3801 | }  | 
                                                        
@@ -3804,27 +3804,27 @@ discard block  | 
                                                    ||
| 3804 | 3804 | }  | 
                                                        
| 3805 | 3805 | |
| 3806 | 3806 |  				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { | 
                                                        
| 3807 | - $optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';  | 
                                                        |
| 3808 | - $optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';  | 
                                                        |
| 3809 | - $optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';  | 
                                                        |
| 3810 | - $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';  | 
                                                        |
| 3811 | - $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';  | 
                                                        |
| 3812 | - $optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';  | 
                                                        |
| 3813 | - $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';  | 
                                                        |
| 3814 | - $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';  | 
                                                        |
| 3815 | - $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';  | 
                                                        |
| 3816 | - $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';  | 
                                                        |
| 3817 | - }  | 
                                                        |
| 3818 | - $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';  | 
                                                        |
| 3807 | + $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';  | 
                                                        |
| 3808 | + $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';  | 
                                                        |
| 3809 | + $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';  | 
                                                        |
| 3810 | + $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';  | 
                                                        |
| 3811 | + $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';  | 
                                                        |
| 3812 | + $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';  | 
                                                        |
| 3813 | + $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';  | 
                                                        |
| 3814 | + $optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';  | 
                                                        |
| 3815 | + $optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';  | 
                                                        |
| 3816 | + $optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"';  | 
                                                        |
| 3817 | + }  | 
                                                        |
| 3818 | + $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';  | 
                                                        |
| 3819 | 3819 | |
| 3820 | 3820 | $outarrayentry = array(  | 
                                                        
| 3821 | 3821 | 'key' => $outkey,  | 
                                                        
| 3822 | 3822 | 'value' => $outref,  | 
                                                        
| 3823 | 3823 | 'label' => $outvallabel,  | 
                                                        
| 3824 | 3824 | 'qty' => $outqty,  | 
                                                        
| 3825 | - 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 3826 | - 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 3827 | - 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 3825 | + 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 3826 | + 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 3827 | + 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 3828 | 3828 | 'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),  | 
                                                        
| 3829 | 3829 | 'tva_tx' => price2num($objp->tva_tx),  | 
                                                        
| 3830 | 3830 | 'default_vat_code' => $objp->default_vat_code,  | 
                                                        
@@ -3849,18 +3849,18 @@ discard block  | 
                                                    ||
| 3849 | 3849 | // Add new entry  | 
                                                        
| 3850 | 3850 | // "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  | 
                                                        
| 3851 | 3851 | // "label" value of json key array is used by jQuery automatically as text for combo box  | 
                                                        
| 3852 | - $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";  | 
                                                        |
| 3852 | + $out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";  | 
                                                        |
| 3853 | 3853 | array_push(  | 
                                                        
| 3854 | 3854 | $outarray,  | 
                                                        
| 3855 | 3855 |  					array('key' => $outkey, | 
                                                        
| 3856 | 3856 | 'value' => $outref,  | 
                                                        
| 3857 | 3857 | 'label' => $outvallabel,  | 
                                                        
| 3858 | 3858 | 'qty' => $outqty,  | 
                                                        
| 3859 | - 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 3859 | + 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 3860 | 3860 | 'price_qty_ht_locale' => price($objp->fprice),  | 
                                                        
| 3861 | - 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 3861 | + 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 3862 | 3862 | 'price_unit_ht_locale' => price($objp->unitprice),  | 
                                                        
| 3863 | - 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 3863 | + 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 3864 | 3864 | 'tva_tx_formated' => price($objp->tva_tx),  | 
                                                        
| 3865 | 3865 | 'tva_tx' => price2num($objp->tva_tx),  | 
                                                        
| 3866 | 3866 | 'default_vat_code' => $objp->default_vat_code,  | 
                                                        
@@ -3887,7 +3887,7 @@ discard block  | 
                                                    ||
| 3887 | 3887 | |
| 3888 | 3888 | $this->db->free($result);  | 
                                                        
| 3889 | 3889 | |
| 3890 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 3890 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 3891 | 3891 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 3892 | 3892 |  		} else { | 
                                                        
| 3893 | 3893 | dol_print_error($this->db);  | 
                                                        
@@ -3919,43 +3919,43 @@ discard block  | 
                                                    ||
| 3919 | 3919 | $sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";  | 
                                                        
| 3920 | 3920 | $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";  | 
                                                        
| 3921 | 3921 | $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";  | 
                                                        
| 3922 | - $sql .= " FROM " . $this->db->prefix() . "product as p";  | 
                                                        |
| 3923 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 3924 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3925 | -		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; | 
                                                        |
| 3922 | + $sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        |
| 3923 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 3924 | + $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3925 | +		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; | 
                                                        |
| 3926 | 3926 | $sql .= " AND p.tobuy = 1";  | 
                                                        
| 3927 | 3927 | $sql .= " AND s.fournisseur = 1";  | 
                                                        
| 3928 | - $sql .= " AND p.rowid = " . ((int) $productid);  | 
                                                        |
| 3928 | + $sql .= " AND p.rowid = ".((int) $productid);  | 
                                                        |
| 3929 | 3929 |  		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { | 
                                                        
| 3930 | 3930 | $sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";  | 
                                                        
| 3931 | 3931 |  		} else { | 
                                                        
| 3932 | 3932 | $sql .= " ORDER BY pfp.unitprice ASC";  | 
                                                        
| 3933 | 3933 | }  | 
                                                        
| 3934 | 3934 | |
| 3935 | - dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);  | 
                                                        |
| 3935 | + dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);  | 
                                                        |
| 3936 | 3936 | $result = $this->db->query($sql);  | 
                                                        
| 3937 | 3937 | |
| 3938 | 3938 |  		if ($result) { | 
                                                        
| 3939 | 3939 | $num = $this->db->num_rows($result);  | 
                                                        
| 3940 | 3940 | |
| 3941 | - $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 3941 | + $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 3942 | 3942 | |
| 3943 | 3943 |  			if (!$num) { | 
                                                        
| 3944 | -				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; | 
                                                        |
| 3944 | +				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; | 
                                                        |
| 3945 | 3945 |  			} else { | 
                                                        
| 3946 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3946 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3947 | 3947 | $form .= '<option value="0"> </option>';  | 
                                                        
| 3948 | 3948 | |
| 3949 | 3949 | $i = 0;  | 
                                                        
| 3950 | 3950 |  				while ($i < $num) { | 
                                                        
| 3951 | 3951 | $objp = $this->db->fetch_object($result);  | 
                                                        
| 3952 | 3952 | |
| 3953 | - $opt = '<option value="' . $objp->idprodfournprice . '"';  | 
                                                        |
| 3953 | + $opt = '<option value="'.$objp->idprodfournprice.'"';  | 
                                                        |
| 3954 | 3954 | //if there is only one supplier, preselect it  | 
                                                        
| 3955 | 3955 |  					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { | 
                                                        
| 3956 | 3956 | $opt .= ' selected';  | 
                                                        
| 3957 | 3957 | }  | 
                                                        
| 3958 | - $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';  | 
                                                        |
| 3958 | + $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';  | 
                                                        |
| 3959 | 3959 | |
| 3960 | 3960 |  					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { | 
                                                        
| 3961 | 3961 | $prod_supplier = new ProductFournisseur($this->db);  | 
                                                        
@@ -3965,7 +3965,7 @@ discard block  | 
                                                    ||
| 3965 | 3965 | $prod_supplier->fourn_tva_tx = $objp->tva_tx;  | 
                                                        
| 3966 | 3966 | $prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;  | 
                                                        
| 3967 | 3967 | |
| 3968 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3968 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3969 | 3969 | $priceparser = new PriceParser($this->db);  | 
                                                        
| 3970 | 3970 | $price_result = $priceparser->parseProductSupplier($prod_supplier);  | 
                                                        
| 3971 | 3971 |  						if ($price_result >= 0) { | 
                                                        
@@ -3976,10 +3976,10 @@ discard block  | 
                                                    ||
| 3976 | 3976 | }  | 
                                                        
| 3977 | 3977 | }  | 
                                                        
| 3978 | 3978 |  					if ($objp->quantity == 1) { | 
                                                        
| 3979 | -						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        |
| 3979 | +						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        |
| 3980 | 3980 | }  | 
                                                        
| 3981 | 3981 | |
| 3982 | - $opt .= $objp->quantity . ' ';  | 
                                                        |
| 3982 | + $opt .= $objp->quantity.' ';  | 
                                                        |
| 3983 | 3983 | |
| 3984 | 3984 |  					if ($objp->quantity == 1) { | 
                                                        
| 3985 | 3985 |  						$opt .= $langs->trans("Unit"); | 
                                                        
@@ -3988,10 +3988,10 @@ discard block  | 
                                                    ||
| 3988 | 3988 | }  | 
                                                        
| 3989 | 3989 |  					if ($objp->quantity > 1) { | 
                                                        
| 3990 | 3990 | $opt .= " - ";  | 
                                                        
| 3991 | -						$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"); | 
                                                        |
| 3991 | +						$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"); | 
                                                        |
| 3992 | 3992 | }  | 
                                                        
| 3993 | 3993 |  					if ($objp->duration) { | 
                                                        
| 3994 | - $opt .= " - " . $objp->duration;  | 
                                                        |
| 3994 | + $opt .= " - ".$objp->duration;  | 
                                                        |
| 3995 | 3995 | }  | 
                                                        
| 3996 | 3996 | $opt .= "</option>\n";  | 
                                                        
| 3997 | 3997 | |
@@ -4029,8 +4029,8 @@ discard block  | 
                                                    ||
| 4029 | 4029 | dol_syslog(__METHOD__, LOG_DEBUG);  | 
                                                        
| 4030 | 4030 | |
| 4031 | 4031 | $sql = "SELECT rowid, code, libelle as label, deposit_percent";  | 
                                                        
| 4032 | - $sql .= " FROM " . $this->db->prefix() . 'c_payment_term';  | 
                                                        |
| 4033 | -		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; | 
                                                        |
| 4032 | + $sql .= " FROM ".$this->db->prefix().'c_payment_term';  | 
                                                        |
| 4033 | +		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; | 
                                                        |
| 4034 | 4034 | $sql .= " AND active > 0";  | 
                                                        
| 4035 | 4035 | $sql .= " ORDER BY sortorder";  | 
                                                        
| 4036 | 4036 | |
@@ -4042,7 +4042,7 @@ discard block  | 
                                                    ||
| 4042 | 4042 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4043 | 4043 | |
| 4044 | 4044 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4045 | -				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4045 | +				$label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4046 | 4046 | $this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 4047 | 4047 | $this->cache_conditions_paiements[$obj->rowid]['label'] = $label;  | 
                                                        
| 4048 | 4048 | $this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;  | 
                                                        
@@ -4070,7 +4070,7 @@ discard block  | 
                                                    ||
| 4070 | 4070 | // phpcs:enable  | 
                                                        
| 4071 | 4071 | global $langs;  | 
                                                        
| 4072 | 4072 | |
| 4073 | - $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability  | 
                                                        |
| 4073 | + $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability  | 
                                                        |
| 4074 | 4074 |  		if ($num > 0) { | 
                                                        
| 4075 | 4075 | return 0; // Cache already loaded  | 
                                                        
| 4076 | 4076 | }  | 
                                                        
@@ -4080,7 +4080,7 @@ discard block  | 
                                                    ||
| 4080 | 4080 |  		$langs->load('propal'); | 
                                                        
| 4081 | 4081 | |
| 4082 | 4082 | $sql = "SELECT rowid, code, label, position";  | 
                                                        
| 4083 | - $sql .= " FROM " . $this->db->prefix() . 'c_availability';  | 
                                                        |
| 4083 | + $sql .= " FROM ".$this->db->prefix().'c_availability';  | 
                                                        |
| 4084 | 4084 | $sql .= " WHERE active > 0";  | 
                                                        
| 4085 | 4085 | |
| 4086 | 4086 | $resql = $this->db->query($sql);  | 
                                                        
@@ -4091,7 +4091,7 @@ discard block  | 
                                                    ||
| 4091 | 4091 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4092 | 4092 | |
| 4093 | 4093 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4094 | -				$label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4094 | +				$label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4095 | 4095 | $this->cache_availability[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 4096 | 4096 | $this->cache_availability[$obj->rowid]['label'] = $label;  | 
                                                        
| 4097 | 4097 | $this->cache_availability[$obj->rowid]['position'] = $obj->position;  | 
                                                        
@@ -4123,17 +4123,17 @@ discard block  | 
                                                    ||
| 4123 | 4123 | |
| 4124 | 4124 | $this->load_cache_availability();  | 
                                                        
| 4125 | 4125 | |
| 4126 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 4126 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 4127 | 4127 | |
| 4128 | - print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4128 | + print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4129 | 4129 |  		if ($addempty) { | 
                                                        
| 4130 | 4130 | print '<option value="0"> </option>';  | 
                                                        
| 4131 | 4131 | }  | 
                                                        
| 4132 | 4132 |  		foreach ($this->cache_availability as $id => $arrayavailability) { | 
                                                        
| 4133 | 4133 |  			if ($selected == $id) { | 
                                                        
| 4134 | - print '<option value="' . $id . '" selected>';  | 
                                                        |
| 4134 | + print '<option value="'.$id.'" selected>';  | 
                                                        |
| 4135 | 4135 |  			} else { | 
                                                        
| 4136 | - print '<option value="' . $id . '">';  | 
                                                        |
| 4136 | + print '<option value="'.$id.'">';  | 
                                                        |
| 4137 | 4137 | }  | 
                                                        
| 4138 | 4138 | print dol_escape_htmltag($arrayavailability['label']);  | 
                                                        
| 4139 | 4139 | print '</option>';  | 
                                                        
@@ -4154,13 +4154,13 @@ discard block  | 
                                                    ||
| 4154 | 4154 |  	{ | 
                                                        
| 4155 | 4155 | global $langs;  | 
                                                        
| 4156 | 4156 | |
| 4157 | - $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason  | 
                                                        |
| 4157 | + $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason  | 
                                                        |
| 4158 | 4158 |  		if ($num > 0) { | 
                                                        
| 4159 | 4159 | return 0; // Cache already loaded  | 
                                                        
| 4160 | 4160 | }  | 
                                                        
| 4161 | 4161 | |
| 4162 | 4162 | $sql = "SELECT rowid, code, label";  | 
                                                        
| 4163 | - $sql .= " FROM " . $this->db->prefix() . 'c_input_reason';  | 
                                                        |
| 4163 | + $sql .= " FROM ".$this->db->prefix().'c_input_reason';  | 
                                                        |
| 4164 | 4164 | $sql .= " WHERE active > 0";  | 
                                                        
| 4165 | 4165 | |
| 4166 | 4166 | $resql = $this->db->query($sql);  | 
                                                        
@@ -4173,8 +4173,8 @@ discard block  | 
                                                    ||
| 4173 | 4173 | |
| 4174 | 4174 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4175 | 4175 | $label = ($obj->label != '-' ? $obj->label : '');  | 
                                                        
| 4176 | -				if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) { | 
                                                        |
| 4177 | -					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work | 
                                                        |
| 4176 | +				if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) { | 
                                                        |
| 4177 | +					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work | 
                                                        |
| 4178 | 4178 | }  | 
                                                        
| 4179 | 4179 |  				if ($langs->trans($obj->code) != $obj->code) { | 
                                                        
| 4180 | 4180 | $label = $langs->trans($obj->code); // So translation key SRC_XXX will work  | 
                                                        
@@ -4214,9 +4214,9 @@ discard block  | 
                                                    ||
| 4214 | 4214 | |
| 4215 | 4215 | $this->loadCacheInputReason();  | 
                                                        
| 4216 | 4216 | |
| 4217 | - print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 4217 | + print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 4218 | 4218 |  		if ($addempty) { | 
                                                        
| 4219 | - print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>';  | 
                                                        |
| 4219 | + print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>';  | 
                                                        |
| 4220 | 4220 | }  | 
                                                        
| 4221 | 4221 |  		foreach ($this->cache_demand_reason as $id => $arraydemandreason) { | 
                                                        
| 4222 | 4222 |  			if ($arraydemandreason['code'] == $exclude) { | 
                                                        
@@ -4224,9 +4224,9 @@ discard block  | 
                                                    ||
| 4224 | 4224 | }  | 
                                                        
| 4225 | 4225 | |
| 4226 | 4226 |  			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { | 
                                                        
| 4227 | - print '<option value="' . $arraydemandreason['id'] . '" selected>';  | 
                                                        |
| 4227 | + print '<option value="'.$arraydemandreason['id'].'" selected>';  | 
                                                        |
| 4228 | 4228 |  			} else { | 
                                                        
| 4229 | - print '<option value="' . $arraydemandreason['id'] . '">';  | 
                                                        |
| 4229 | + print '<option value="'.$arraydemandreason['id'].'">';  | 
                                                        |
| 4230 | 4230 | }  | 
                                                        
| 4231 | 4231 | $label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason  | 
                                                        
| 4232 | 4232 | print $langs->trans($label);  | 
                                                        
@@ -4236,7 +4236,7 @@ discard block  | 
                                                    ||
| 4236 | 4236 |  		if ($user->admin && empty($notooltip)) { | 
                                                        
| 4237 | 4237 |  			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
| 4238 | 4238 | }  | 
                                                        
| 4239 | -		print ajax_combobox('select_' . $htmlname); | 
                                                        |
| 4239 | +		print ajax_combobox('select_'.$htmlname); | 
                                                        |
| 4240 | 4240 | }  | 
                                                        
| 4241 | 4241 | |
| 4242 | 4242 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps  | 
                                                        
@@ -4251,7 +4251,7 @@ discard block  | 
                                                    ||
| 4251 | 4251 | // phpcs:enable  | 
                                                        
| 4252 | 4252 | global $langs;  | 
                                                        
| 4253 | 4253 | |
| 4254 | - $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements  | 
                                                        |
| 4254 | + $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements  | 
                                                        |
| 4255 | 4255 |  		if ($num > 0) { | 
                                                        
| 4256 | 4256 | return $num; // Cache already loaded  | 
                                                        
| 4257 | 4257 | }  | 
                                                        
@@ -4261,8 +4261,8 @@ discard block  | 
                                                    ||
| 4261 | 4261 | $this->cache_types_paiements = array();  | 
                                                        
| 4262 | 4262 | |
| 4263 | 4263 | $sql = "SELECT id, code, libelle as label, type, active";  | 
                                                        
| 4264 | - $sql .= " FROM " . $this->db->prefix() . "c_paiement";  | 
                                                        |
| 4265 | -		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; | 
                                                        |
| 4264 | + $sql .= " FROM ".$this->db->prefix()."c_paiement";  | 
                                                        |
| 4265 | +		$sql .= " WHERE entity IN (".getEntity('c_paiement').")"; | 
                                                        |
| 4266 | 4266 | |
| 4267 | 4267 | $resql = $this->db->query($sql);  | 
                                                        
| 4268 | 4268 |  		if ($resql) { | 
                                                        
@@ -4272,7 +4272,7 @@ discard block  | 
                                                    ||
| 4272 | 4272 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4273 | 4273 | |
| 4274 | 4274 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4275 | -				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4275 | +				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4276 | 4276 | $this->cache_types_paiements[$obj->id]['id'] = $obj->id;  | 
                                                        
| 4277 | 4277 | $this->cache_types_paiements[$obj->id]['code'] = $obj->code;  | 
                                                        
| 4278 | 4278 | $this->cache_types_paiements[$obj->id]['label'] = $label;  | 
                                                        
@@ -4344,17 +4344,17 @@ discard block  | 
                                                    ||
| 4344 | 4344 | global $langs, $user, $conf;  | 
                                                        
| 4345 | 4345 | |
| 4346 | 4346 | $out = '';  | 
                                                        
| 4347 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 4347 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 4348 | 4348 | |
| 4349 | 4349 | $this->load_cache_conditions_paiements();  | 
                                                        
| 4350 | 4350 | |
| 4351 | 4351 | // Set default value if not already set by caller  | 
                                                        
| 4352 | 4352 |  		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { | 
                                                        
| 4353 | - dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);  | 
                                                        |
| 4353 | + dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);  | 
                                                        |
| 4354 | 4354 |  			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); | 
                                                        
| 4355 | 4355 | }  | 
                                                        
| 4356 | 4356 | |
| 4357 | - $out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4357 | + $out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4358 | 4358 |  		if ($addempty) { | 
                                                        
| 4359 | 4359 | $out .= '<option value="0"> </option>';  | 
                                                        
| 4360 | 4360 | }  | 
                                                        
@@ -4368,9 +4368,9 @@ discard block  | 
                                                    ||
| 4368 | 4368 | |
| 4369 | 4369 |  			if ($selected == $id) { | 
                                                        
| 4370 | 4370 | $selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];  | 
                                                        
| 4371 | - $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';  | 
                                                        |
| 4371 | + $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';  | 
                                                        |
| 4372 | 4372 |  			} else { | 
                                                        
| 4373 | - $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';  | 
                                                        |
| 4373 | + $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';  | 
                                                        |
| 4374 | 4374 | }  | 
                                                        
| 4375 | 4375 | $label = $arrayconditions['label'];  | 
                                                        
| 4376 | 4376 | |
@@ -4388,21 +4388,21 @@ discard block  | 
                                                    ||
| 4388 | 4388 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 4389 | 4389 | |
| 4390 | 4390 |  		if ($deposit_percent >= 0) { | 
                                                        
| 4391 | - $out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';  | 
                                                        |
| 4392 | -			$out .= $langs->trans('DepositPercent') . ' : '; | 
                                                        |
| 4393 | - $out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />';  | 
                                                        |
| 4391 | + $out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';  | 
                                                        |
| 4392 | +			$out .= $langs->trans('DepositPercent').' : '; | 
                                                        |
| 4393 | + $out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />';  | 
                                                        |
| 4394 | 4394 | $out .= '</span>';  | 
                                                        
| 4395 | 4395 | $out .= '  | 
                                                        
| 4396 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 4396 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 4397 | 4397 |  					$(document).ready(function () { | 
                                                        
| 4398 | -						$("#' . $htmlname . '").change(function () { | 
                                                        |
| 4398 | +						$("#' . $htmlname.'").change(function () { | 
                                                        |
| 4399 | 4399 |  							let $selected = $(this).find("option:selected"); | 
                                                        
| 4400 | 4400 |  							let depositPercent = $selected.attr("data-deposit_percent"); | 
                                                        
| 4401 | 4401 | |
| 4402 | 4402 |  							if (depositPercent.length > 0) { | 
                                                        
| 4403 | -								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); | 
                                                        |
| 4403 | +								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); | 
                                                        |
| 4404 | 4404 |  							} else { | 
                                                        
| 4405 | -								$("#' . $htmlname . '_deposit_percent_container").hide(); | 
                                                        |
| 4405 | +								$("#' . $htmlname.'_deposit_percent_container").hide(); | 
                                                        |
| 4406 | 4406 | }  | 
                                                        
| 4407 | 4407 | |
| 4408 | 4408 | return true;  | 
                                                        
@@ -4440,7 +4440,7 @@ discard block  | 
                                                    ||
| 4440 | 4440 | |
| 4441 | 4441 | $out = '';  | 
                                                        
| 4442 | 4442 | |
| 4443 | - dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);  | 
                                                        |
| 4443 | + dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);  | 
                                                        |
| 4444 | 4444 | |
| 4445 | 4445 | $filterarray = array();  | 
                                                        
| 4446 | 4446 |  		if ($filtertype == 'CRDT') { | 
                                                        
@@ -4455,11 +4455,11 @@ discard block  | 
                                                    ||
| 4455 | 4455 | |
| 4456 | 4456 | // Set default value if not already set by caller  | 
                                                        
| 4457 | 4457 |  		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { | 
                                                        
| 4458 | - dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);  | 
                                                        |
| 4458 | + dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);  | 
                                                        |
| 4459 | 4459 |  			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); | 
                                                        
| 4460 | 4460 | }  | 
                                                        
| 4461 | 4461 | |
| 4462 | - $out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4462 | + $out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4463 | 4463 |  		if ($empty) { | 
                                                        
| 4464 | 4464 | $out .= '<option value=""> </option>';  | 
                                                        
| 4465 | 4465 | }  | 
                                                        
@@ -4480,13 +4480,13 @@ discard block  | 
                                                    ||
| 4480 | 4480 | }  | 
                                                        
| 4481 | 4481 | |
| 4482 | 4482 |  			if ($format == 0) { | 
                                                        
| 4483 | - $out .= '<option value="' . $id . '"';  | 
                                                        |
| 4483 | + $out .= '<option value="'.$id.'"';  | 
                                                        |
| 4484 | 4484 |  			} elseif ($format == 1) { | 
                                                        
| 4485 | - $out .= '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4485 | + $out .= '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4486 | 4486 |  			} elseif ($format == 2) { | 
                                                        
| 4487 | - $out .= '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4487 | + $out .= '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4488 | 4488 |  			} elseif ($format == 3) { | 
                                                        
| 4489 | - $out .= '<option value="' . $id . '"';  | 
                                                        |
| 4489 | + $out .= '<option value="'.$id.'"';  | 
                                                        |
| 4490 | 4490 | }  | 
                                                        
| 4491 | 4491 | // Print attribute selected or not  | 
                                                        
| 4492 | 4492 |  			if ($format == 1 || $format == 2) { | 
                                                        
@@ -4516,7 +4516,7 @@ discard block  | 
                                                    ||
| 4516 | 4516 |  		if ($user->admin && !$noadmininfo) { | 
                                                        
| 4517 | 4517 |  			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
| 4518 | 4518 | }  | 
                                                        
| 4519 | -		$out .= ajax_combobox('select' . $htmlname); | 
                                                        |
| 4519 | +		$out .= ajax_combobox('select'.$htmlname); | 
                                                        |
| 4520 | 4520 | |
| 4521 | 4521 |  		if (empty($nooutput)) { | 
                                                        
| 4522 | 4522 | print $out;  | 
                                                        
@@ -4538,22 +4538,22 @@ discard block  | 
                                                    ||
| 4538 | 4538 |  	{ | 
                                                        
| 4539 | 4539 | global $langs;  | 
                                                        
| 4540 | 4540 | |
| 4541 | - $return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 4541 | + $return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 4542 | 4542 | $options = array(  | 
                                                        
| 4543 | 4543 |  			'HT' => $langs->trans("HT"), | 
                                                        
| 4544 | 4544 |  			'TTC' => $langs->trans("TTC") | 
                                                        
| 4545 | 4545 | );  | 
                                                        
| 4546 | 4546 |  		foreach ($options as $id => $value) { | 
                                                        
| 4547 | 4547 |  			if ($selected == $id) { | 
                                                        
| 4548 | - $return .= '<option value="' . $id . '" selected>' . $value;  | 
                                                        |
| 4548 | + $return .= '<option value="'.$id.'" selected>'.$value;  | 
                                                        |
| 4549 | 4549 |  			} else { | 
                                                        
| 4550 | - $return .= '<option value="' . $id . '">' . $value;  | 
                                                        |
| 4550 | + $return .= '<option value="'.$id.'">'.$value;  | 
                                                        |
| 4551 | 4551 | }  | 
                                                        
| 4552 | 4552 | $return .= '</option>';  | 
                                                        
| 4553 | 4553 | }  | 
                                                        
| 4554 | 4554 | $return .= '</select>';  | 
                                                        
| 4555 | 4555 |  		if ($addjscombo) { | 
                                                        
| 4556 | -			$return .= ajax_combobox('select_' . $htmlname); | 
                                                        |
| 4556 | +			$return .= ajax_combobox('select_'.$htmlname); | 
                                                        |
| 4557 | 4557 | }  | 
                                                        
| 4558 | 4558 | |
| 4559 | 4559 | return $return;  | 
                                                        
@@ -4571,7 +4571,7 @@ discard block  | 
                                                    ||
| 4571 | 4571 | // phpcs:enable  | 
                                                        
| 4572 | 4572 | global $langs;  | 
                                                        
| 4573 | 4573 | |
| 4574 | - $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode  | 
                                                        |
| 4574 | + $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode  | 
                                                        |
| 4575 | 4575 |  		if ($num > 0) { | 
                                                        
| 4576 | 4576 | return $num; // Cache already loaded  | 
                                                        
| 4577 | 4577 | }  | 
                                                        
@@ -4581,8 +4581,8 @@ discard block  | 
                                                    ||
| 4581 | 4581 | $this->cache_transport_mode = array();  | 
                                                        
| 4582 | 4582 | |
| 4583 | 4583 | $sql = "SELECT rowid, code, label, active";  | 
                                                        
| 4584 | - $sql .= " FROM " . $this->db->prefix() . "c_transport_mode";  | 
                                                        |
| 4585 | -		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; | 
                                                        |
| 4584 | + $sql .= " FROM ".$this->db->prefix()."c_transport_mode";  | 
                                                        |
| 4585 | +		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; | 
                                                        |
| 4586 | 4586 | |
| 4587 | 4587 | $resql = $this->db->query($sql);  | 
                                                        
| 4588 | 4588 |  		if ($resql) { | 
                                                        
@@ -4592,7 +4592,7 @@ discard block  | 
                                                    ||
| 4592 | 4592 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4593 | 4593 | |
| 4594 | 4594 | // If traduction exist, we use it else we take the default label  | 
                                                        
| 4595 | -				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4595 | +				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4596 | 4596 | $this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;  | 
                                                        
| 4597 | 4597 | $this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 4598 | 4598 | $this->cache_transport_mode[$obj->rowid]['label'] = $label;  | 
                                                        
@@ -4626,11 +4626,11 @@ discard block  | 
                                                    ||
| 4626 | 4626 |  	{ | 
                                                        
| 4627 | 4627 | global $langs, $user;  | 
                                                        
| 4628 | 4628 | |
| 4629 | - dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG);  | 
                                                        |
| 4629 | + dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);  | 
                                                        |
| 4630 | 4630 | |
| 4631 | 4631 | $this->load_cache_transport_mode();  | 
                                                        
| 4632 | 4632 | |
| 4633 | - print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4633 | + print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4634 | 4634 |  		if ($empty) { | 
                                                        
| 4635 | 4635 | print '<option value=""> </option>';  | 
                                                        
| 4636 | 4636 | }  | 
                                                        
@@ -4646,13 +4646,13 @@ discard block  | 
                                                    ||
| 4646 | 4646 | }  | 
                                                        
| 4647 | 4647 | |
| 4648 | 4648 |  			if ($format == 0) { | 
                                                        
| 4649 | - print '<option value="' . $id . '"';  | 
                                                        |
| 4649 | + print '<option value="'.$id.'"';  | 
                                                        |
| 4650 | 4650 |  			} elseif ($format == 1) { | 
                                                        
| 4651 | - print '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4651 | + print '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4652 | 4652 |  			} elseif ($format == 2) { | 
                                                        
| 4653 | - print '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4653 | + print '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4654 | 4654 |  			} elseif ($format == 3) { | 
                                                        
| 4655 | - print '<option value="' . $id . '"';  | 
                                                        |
| 4655 | + print '<option value="'.$id.'"';  | 
                                                        |
| 4656 | 4656 | }  | 
                                                        
| 4657 | 4657 | // If text is selected, we compare with code, else with id  | 
                                                        
| 4658 | 4658 |  			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { | 
                                                        
@@ -4700,31 +4700,31 @@ discard block  | 
                                                    ||
| 4700 | 4700 |  		$langs->load("deliveries"); | 
                                                        
| 4701 | 4701 | |
| 4702 | 4702 | $sql = "SELECT rowid, code, libelle as label";  | 
                                                        
| 4703 | - $sql .= " FROM " . $this->db->prefix() . "c_shipment_mode";  | 
                                                        |
| 4703 | + $sql .= " FROM ".$this->db->prefix()."c_shipment_mode";  | 
                                                        |
| 4704 | 4704 | $sql .= " WHERE active > 0";  | 
                                                        
| 4705 | 4705 |  		if ($filtre) { | 
                                                        
| 4706 | - $sql .= " AND " . $filtre;  | 
                                                        |
| 4706 | + $sql .= " AND ".$filtre;  | 
                                                        |
| 4707 | 4707 | }  | 
                                                        
| 4708 | 4708 | $sql .= " ORDER BY libelle ASC";  | 
                                                        
| 4709 | 4709 | |
| 4710 | - dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);  | 
                                                        |
| 4710 | + dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);  | 
                                                        |
| 4711 | 4711 | $result = $this->db->query($sql);  | 
                                                        
| 4712 | 4712 |  		if ($result) { | 
                                                        
| 4713 | 4713 | $num = $this->db->num_rows($result);  | 
                                                        
| 4714 | 4714 | $i = 0;  | 
                                                        
| 4715 | 4715 |  			if ($num) { | 
                                                        
| 4716 | - print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        |
| 4716 | + print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        |
| 4717 | 4717 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 4718 | 4718 | print '<option value="-1"> </option>';  | 
                                                        
| 4719 | 4719 | }  | 
                                                        
| 4720 | 4720 |  				while ($i < $num) { | 
                                                        
| 4721 | 4721 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 4722 | 4722 |  					if ($selected == $obj->rowid) { | 
                                                        
| 4723 | - print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        |
| 4723 | + print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        |
| 4724 | 4724 |  					} else { | 
                                                        
| 4725 | - print '<option value="' . $obj->rowid . '">';  | 
                                                        |
| 4725 | + print '<option value="'.$obj->rowid.'">';  | 
                                                        |
| 4726 | 4726 | }  | 
                                                        
| 4727 | -					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; | 
                                                        |
| 4727 | +					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; | 
                                                        |
| 4728 | 4728 | print '</option>';  | 
                                                        
| 4729 | 4729 | $i++;  | 
                                                        
| 4730 | 4730 | }  | 
                                                        
@@ -4733,7 +4733,7 @@ discard block  | 
                                                    ||
| 4733 | 4733 |  					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
| 4734 | 4734 | }  | 
                                                        
| 4735 | 4735 | |
| 4736 | -				print ajax_combobox('select' . $htmlname); | 
                                                        |
| 4736 | +				print ajax_combobox('select'.$htmlname); | 
                                                        |
| 4737 | 4737 |  			} else { | 
                                                        
| 4738 | 4738 |  				print $langs->trans("NoShippingMethodDefined"); | 
                                                        
| 4739 | 4739 | }  | 
                                                        
@@ -4758,16 +4758,16 @@ discard block  | 
                                                    ||
| 4758 | 4758 |  		$langs->load("deliveries"); | 
                                                        
| 4759 | 4759 | |
| 4760 | 4760 |  		if ($htmlname != "none") { | 
                                                        
| 4761 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 4761 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 4762 | 4762 | print '<input type="hidden" name="action" value="setshippingmethod">';  | 
                                                        
| 4763 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 4763 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 4764 | 4764 | $this->selectShippingMethod($selected, $htmlname, '', $addempty);  | 
                                                        
| 4765 | -			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 4765 | +			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 4766 | 4766 | print '</form>';  | 
                                                        
| 4767 | 4767 |  		} else { | 
                                                        
| 4768 | 4768 |  			if ($selected) { | 
                                                        
| 4769 | 4769 | $code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');  | 
                                                        
| 4770 | -				print $langs->trans("SendingMethod" . strtoupper($code)); | 
                                                        |
| 4770 | +				print $langs->trans("SendingMethod".strtoupper($code)); | 
                                                        |
| 4771 | 4771 |  			} else { | 
                                                        
| 4772 | 4772 | print " ";  | 
                                                        
| 4773 | 4773 | }  | 
                                                        
@@ -4790,10 +4790,10 @@ discard block  | 
                                                    ||
| 4790 | 4790 | |
| 4791 | 4791 | $opt = '<option value="" selected></option>';  | 
                                                        
| 4792 | 4792 | $sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";  | 
                                                        
| 4793 | - $sql .= ' FROM ' . $this->db->prefix() . 'facture';  | 
                                                        |
| 4794 | -		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; | 
                                                        |
| 4793 | + $sql .= ' FROM '.$this->db->prefix().'facture';  | 
                                                        |
| 4794 | +		$sql .= ' WHERE entity IN ('.getEntity('invoice').')'; | 
                                                        |
| 4795 | 4795 | $sql .= ' AND situation_counter >= 1';  | 
                                                        
| 4796 | - $sql .= ' AND fk_soc = ' . (int) $socid;  | 
                                                        |
| 4796 | + $sql .= ' AND fk_soc = '.(int) $socid;  | 
                                                        |
| 4797 | 4797 | $sql .= ' AND type <> 2';  | 
                                                        
| 4798 | 4798 | $sql .= ' ORDER by situation_cycle_ref, situation_counter desc';  | 
                                                        
| 4799 | 4799 | $resql = $this->db->query($sql);  | 
                                                        
@@ -4811,19 +4811,19 @@ discard block  | 
                                                    ||
| 4811 | 4811 | //Not prov?  | 
                                                        
| 4812 | 4812 |  						if (substr($obj->ref, 1, 4) != 'PROV') { | 
                                                        
| 4813 | 4813 |  							if ($selected == $obj->rowid) { | 
                                                        
| 4814 | - $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';  | 
                                                        |
| 4814 | + $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';  | 
                                                        |
| 4815 | 4815 |  							} else { | 
                                                        
| 4816 | - $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';  | 
                                                        |
| 4816 | + $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';  | 
                                                        |
| 4817 | 4817 | }  | 
                                                        
| 4818 | 4818 | }  | 
                                                        
| 4819 | 4819 | }  | 
                                                        
| 4820 | 4820 | }  | 
                                                        
| 4821 | 4821 | }  | 
                                                        
| 4822 | 4822 |  		} else { | 
                                                        
| 4823 | -			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); | 
                                                        |
| 4823 | +			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); | 
                                                        |
| 4824 | 4824 | }  | 
                                                        
| 4825 | 4825 |  		if ($opt == '<option value ="" selected></option>') { | 
                                                        
| 4826 | -			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; | 
                                                        |
| 4826 | +			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; | 
                                                        |
| 4827 | 4827 | }  | 
                                                        
| 4828 | 4828 | return $opt;  | 
                                                        
| 4829 | 4829 | }  | 
                                                        
@@ -4843,12 +4843,12 @@ discard block  | 
                                                    ||
| 4843 | 4843 | |
| 4844 | 4844 |  		$langs->load('products'); | 
                                                        
| 4845 | 4845 | |
| 4846 | - $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 4846 | + $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 4847 | 4847 | |
| 4848 | - $sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units";  | 
                                                        |
| 4848 | + $sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";  | 
                                                        |
| 4849 | 4849 | $sql .= ' WHERE active > 0';  | 
                                                        
| 4850 | 4850 |  		if (!empty($unit_type)) { | 
                                                        
| 4851 | - $sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'";  | 
                                                        |
| 4851 | + $sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";  | 
                                                        |
| 4852 | 4852 | }  | 
                                                        
| 4853 | 4853 | $sql .= " ORDER BY sortorder";  | 
                                                        
| 4854 | 4854 | |
@@ -4860,14 +4860,14 @@ discard block  | 
                                                    ||
| 4860 | 4860 | |
| 4861 | 4861 |  			while ($res = $this->db->fetch_object($resql)) { | 
                                                        
| 4862 | 4862 | $unitLabel = $res->label;  | 
                                                        
| 4863 | -				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before | 
                                                        |
| 4864 | -					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; | 
                                                        |
| 4863 | +				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before | 
                                                        |
| 4864 | +					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; | 
                                                        |
| 4865 | 4865 | }  | 
                                                        
| 4866 | 4866 | |
| 4867 | 4867 |  				if ($selected == $res->rowid) { | 
                                                        
| 4868 | - $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';  | 
                                                        |
| 4868 | + $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';  | 
                                                        |
| 4869 | 4869 |  				} else { | 
                                                        
| 4870 | - $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';  | 
                                                        |
| 4870 | + $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';  | 
                                                        |
| 4871 | 4871 | }  | 
                                                        
| 4872 | 4872 | }  | 
                                                        
| 4873 | 4873 | $return .= '</select>';  | 
                                                        
@@ -4902,23 +4902,23 @@ discard block  | 
                                                    ||
| 4902 | 4902 | $num = 0;  | 
                                                        
| 4903 | 4903 | |
| 4904 | 4904 | $sql = "SELECT rowid, label, bank, clos as status, currency_code";  | 
                                                        
| 4905 | - $sql .= " FROM " . $this->db->prefix() . "bank_account";  | 
                                                        |
| 4906 | -		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; | 
                                                        |
| 4905 | + $sql .= " FROM ".$this->db->prefix()."bank_account";  | 
                                                        |
| 4906 | +		$sql .= " WHERE entity IN (".getEntity('bank_account').")"; | 
                                                        |
| 4907 | 4907 |  		if ($status != 2) { | 
                                                        
| 4908 | - $sql .= " AND clos = " . (int) $status;  | 
                                                        |
| 4908 | + $sql .= " AND clos = ".(int) $status;  | 
                                                        |
| 4909 | 4909 | }  | 
                                                        
| 4910 | 4910 |  		if ($filtre) { | 
                                                        
| 4911 | - $sql .= " AND " . $filtre;  | 
                                                        |
| 4911 | + $sql .= " AND ".$filtre;  | 
                                                        |
| 4912 | 4912 | }  | 
                                                        
| 4913 | 4913 | $sql .= " ORDER BY label";  | 
                                                        
| 4914 | 4914 | |
| 4915 | - dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);  | 
                                                        |
| 4915 | + dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);  | 
                                                        |
| 4916 | 4916 | $result = $this->db->query($sql);  | 
                                                        
| 4917 | 4917 |  		if ($result) { | 
                                                        
| 4918 | 4918 | $num = $this->db->num_rows($result);  | 
                                                        
| 4919 | 4919 | $i = 0;  | 
                                                        
| 4920 | 4920 |  			if ($num) { | 
                                                        
| 4921 | - $out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        |
| 4921 | + $out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        |
| 4922 | 4922 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 4923 | 4923 | $out .= '<option value="-1"> </option>';  | 
                                                        
| 4924 | 4924 | }  | 
                                                        
@@ -4926,27 +4926,27 @@ discard block  | 
                                                    ||
| 4926 | 4926 |  				while ($i < $num) { | 
                                                        
| 4927 | 4927 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 4928 | 4928 |  					if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { | 
                                                        
| 4929 | - $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>';  | 
                                                        |
| 4929 | + $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>';  | 
                                                        |
| 4930 | 4930 |  					} else { | 
                                                        
| 4931 | - $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">';  | 
                                                        |
| 4931 | + $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">';  | 
                                                        |
| 4932 | 4932 | }  | 
                                                        
| 4933 | 4933 | $out .= trim($obj->label);  | 
                                                        
| 4934 | 4934 |  					if ($showcurrency) { | 
                                                        
| 4935 | -						$out .= ' (' . $obj->currency_code . ')'; | 
                                                        |
| 4935 | +						$out .= ' ('.$obj->currency_code.')'; | 
                                                        |
| 4936 | 4936 | }  | 
                                                        
| 4937 | 4937 |  					if ($status == 2 && $obj->status == 1) { | 
                                                        
| 4938 | -						$out .= ' (' . $langs->trans("Closed") . ')'; | 
                                                        |
| 4938 | +						$out .= ' ('.$langs->trans("Closed").')'; | 
                                                        |
| 4939 | 4939 | }  | 
                                                        
| 4940 | 4940 | $out .= '</option>';  | 
                                                        
| 4941 | 4941 | $i++;  | 
                                                        
| 4942 | 4942 | }  | 
                                                        
| 4943 | 4943 | $out .= "</select>";  | 
                                                        
| 4944 | -				$out .= ajax_combobox('select' . $htmlname); | 
                                                        |
| 4944 | +				$out .= ajax_combobox('select'.$htmlname); | 
                                                        |
| 4945 | 4945 |  			} else { | 
                                                        
| 4946 | 4946 |  				if ($status == 0) { | 
                                                        
| 4947 | -					$out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; | 
                                                        |
| 4947 | +					$out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; | 
                                                        |
| 4948 | 4948 |  				} else { | 
                                                        
| 4949 | -					$out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; | 
                                                        |
| 4949 | +					$out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>'; | 
                                                        |
| 4950 | 4950 | }  | 
                                                        
| 4951 | 4951 | }  | 
                                                        
| 4952 | 4952 |  		} else { | 
                                                        
@@ -4982,23 +4982,23 @@ discard block  | 
                                                    ||
| 4982 | 4982 | $num = 0;  | 
                                                        
| 4983 | 4983 | |
| 4984 | 4984 | $sql = "SELECT rowid, name, fk_country, status, entity";  | 
                                                        
| 4985 | - $sql .= " FROM " . $this->db->prefix() . "establishment";  | 
                                                        |
| 4985 | + $sql .= " FROM ".$this->db->prefix()."establishment";  | 
                                                        |
| 4986 | 4986 | $sql .= " WHERE 1=1";  | 
                                                        
| 4987 | 4987 |  		if ($status != 2) { | 
                                                        
| 4988 | - $sql .= " AND status = " . (int) $status;  | 
                                                        |
| 4988 | + $sql .= " AND status = ".(int) $status;  | 
                                                        |
| 4989 | 4989 | }  | 
                                                        
| 4990 | 4990 |  		if ($filtre) { | 
                                                        
| 4991 | - $sql .= " AND " . $filtre;  | 
                                                        |
| 4991 | + $sql .= " AND ".$filtre;  | 
                                                        |
| 4992 | 4992 | }  | 
                                                        
| 4993 | 4993 | $sql .= " ORDER BY name";  | 
                                                        
| 4994 | 4994 | |
| 4995 | - dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG);  | 
                                                        |
| 4995 | + dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);  | 
                                                        |
| 4996 | 4996 | $result = $this->db->query($sql);  | 
                                                        
| 4997 | 4997 |  		if ($result) { | 
                                                        
| 4998 | 4998 | $num = $this->db->num_rows($result);  | 
                                                        
| 4999 | 4999 | $i = 0;  | 
                                                        
| 5000 | 5000 |  			if ($num) { | 
                                                        
| 5001 | - print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        |
| 5001 | + print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        |
| 5002 | 5002 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 5003 | 5003 | print '<option value="-1"> </option>';  | 
                                                        
| 5004 | 5004 | }  | 
                                                        
@@ -5006,13 +5006,13 @@ discard block  | 
                                                    ||
| 5006 | 5006 |  				while ($i < $num) { | 
                                                        
| 5007 | 5007 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 5008 | 5008 |  					if ($selected == $obj->rowid) { | 
                                                        
| 5009 | - print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        |
| 5009 | + print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        |
| 5010 | 5010 |  					} else { | 
                                                        
| 5011 | - print '<option value="' . $obj->rowid . '">';  | 
                                                        |
| 5011 | + print '<option value="'.$obj->rowid.'">';  | 
                                                        |
| 5012 | 5012 | }  | 
                                                        
| 5013 | 5013 | print trim($obj->name);  | 
                                                        
| 5014 | 5014 |  					if ($status == 2 && $obj->status == 1) { | 
                                                        
| 5015 | -						print ' (' . $langs->trans("Closed") . ')'; | 
                                                        |
| 5015 | +						print ' ('.$langs->trans("Closed").')'; | 
                                                        |
| 5016 | 5016 | }  | 
                                                        
| 5017 | 5017 | print '</option>';  | 
                                                        
| 5018 | 5018 | $i++;  | 
                                                        
@@ -5020,9 +5020,9 @@ discard block  | 
                                                    ||
| 5020 | 5020 | print "</select>";  | 
                                                        
| 5021 | 5021 |  			} else { | 
                                                        
| 5022 | 5022 |  				if ($status == 0) { | 
                                                        
| 5023 | -					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; | 
                                                        |
| 5023 | +					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; | 
                                                        |
| 5024 | 5024 |  				} else { | 
                                                        
| 5025 | -					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; | 
                                                        |
| 5025 | +					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; | 
                                                        |
| 5026 | 5026 | }  | 
                                                        
| 5027 | 5027 | }  | 
                                                        
| 5028 | 5028 | |
@@ -5046,20 +5046,20 @@ discard block  | 
                                                    ||
| 5046 | 5046 |  	{ | 
                                                        
| 5047 | 5047 | global $langs;  | 
                                                        
| 5048 | 5048 |  		if ($htmlname != "none") { | 
                                                        
| 5049 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5049 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5050 | 5050 | print '<input type="hidden" name="action" value="setbankaccount">';  | 
                                                        
| 5051 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5051 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5052 | 5052 |  			print img_picto('', 'bank_account', 'class="pictofixedwidth"'); | 
                                                        
| 5053 | 5053 | $nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);  | 
                                                        
| 5054 | 5054 |  			if ($nbaccountfound > 0) { | 
                                                        
| 5055 | -				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5055 | +				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5056 | 5056 | }  | 
                                                        
| 5057 | 5057 | print '</form>';  | 
                                                        
| 5058 | 5058 |  		} else { | 
                                                        
| 5059 | 5059 |  			$langs->load('banks'); | 
                                                        
| 5060 | 5060 | |
| 5061 | 5061 |  			if ($selected) { | 
                                                        
| 5062 | - require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';  | 
                                                        |
| 5062 | + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';  | 
                                                        |
| 5063 | 5063 | $bankstatic = new Account($this->db);  | 
                                                        
| 5064 | 5064 | $result = $bankstatic->fetch($selected);  | 
                                                        
| 5065 | 5065 |  				if ($result) { | 
                                                        
@@ -5097,19 +5097,19 @@ discard block  | 
                                                    ||
| 5097 | 5097 | global $conf, $langs;  | 
                                                        
| 5098 | 5098 |  		$langs->load("categories"); | 
                                                        
| 5099 | 5099 | |
| 5100 | - include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';  | 
                                                        |
| 5100 | + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';  | 
                                                        |
| 5101 | 5101 | |
| 5102 | 5102 | // For backward compatibility  | 
                                                        
| 5103 | 5103 |  		if (is_numeric($type)) { | 
                                                        
| 5104 | - dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);  | 
                                                        |
| 5104 | + dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);  | 
                                                        |
| 5105 | 5105 | }  | 
                                                        
| 5106 | 5106 | |
| 5107 | 5107 |  		if ($type === Categorie::TYPE_BANK_LINE) { | 
                                                        
| 5108 | 5108 | // TODO Move this into common category feature  | 
                                                        
| 5109 | 5109 | $cate_arbo = array();  | 
                                                        
| 5110 | 5110 | $sql = "SELECT c.label, c.rowid";  | 
                                                        
| 5111 | - $sql .= " FROM " . $this->db->prefix() . "bank_categ as c";  | 
                                                        |
| 5112 | - $sql .= " WHERE entity = " . $conf->entity;  | 
                                                        |
| 5111 | + $sql .= " FROM ".$this->db->prefix()."bank_categ as c";  | 
                                                        |
| 5112 | + $sql .= " WHERE entity = ".$conf->entity;  | 
                                                        |
| 5113 | 5113 | $sql .= " ORDER BY c.label";  | 
                                                        
| 5114 | 5114 | $result = $this->db->query($sql);  | 
                                                        
| 5115 | 5115 |  			if ($result) { | 
                                                        
@@ -5134,10 +5134,10 @@ discard block  | 
                                                    ||
| 5134 | 5134 | $outarray = array();  | 
                                                        
| 5135 | 5135 | $outarrayrichhtml = array();  | 
                                                        
| 5136 | 5136 | |
| 5137 | - $output = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 5137 | + $output = '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 5138 | 5138 |  		if (is_array($cate_arbo)) { | 
                                                        
| 5139 | 5139 |  			if (!count($cate_arbo)) { | 
                                                        
| 5140 | -				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; | 
                                                        |
| 5140 | +				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; | 
                                                        |
| 5141 | 5141 |  			} else { | 
                                                        
| 5142 | 5142 | $output .= '<option value="-1"> </option>';  | 
                                                        
| 5143 | 5143 |  				foreach ($cate_arbo as $key => $value) { | 
                                                        
@@ -5147,15 +5147,15 @@ discard block  | 
                                                    ||
| 5147 | 5147 | $add = '';  | 
                                                        
| 5148 | 5148 | }  | 
                                                        
| 5149 | 5149 | |
| 5150 | -					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); | 
                                                        |
| 5150 | +					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); | 
                                                        |
| 5151 | 5151 | $labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');  | 
                                                        
| 5152 | 5152 | |
| 5153 | 5153 | $outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];  | 
                                                        
| 5154 | 5154 | |
| 5155 | 5155 | $outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow;  | 
                                                        
| 5156 | 5156 | |
| 5157 | - $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"';  | 
                                                        |
| 5158 | - $output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"';  | 
                                                        |
| 5157 | + $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';  | 
                                                        |
| 5158 | + $output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"';  | 
                                                        |
| 5159 | 5159 | $output .= '>';  | 
                                                        
| 5160 | 5160 | $output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');  | 
                                                        
| 5161 | 5161 | $output .= '</option>';  | 
                                                        
@@ -5196,7 +5196,7 @@ discard block  | 
                                                    ||
| 5196 | 5196 | public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)  | 
                                                        
| 5197 | 5197 |  	{ | 
                                                        
| 5198 | 5198 | // phpcs:enable  | 
                                                        
| 5199 | - dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);  | 
                                                        |
| 5199 | + dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);  | 
                                                        |
| 5200 | 5200 | print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);  | 
                                                        
| 5201 | 5201 | }  | 
                                                        
| 5202 | 5202 | |
@@ -5231,7 +5231,7 @@ discard block  | 
                                                    ||
| 5231 | 5231 |  	{ | 
                                                        
| 5232 | 5232 | global $langs, $conf;  | 
                                                        
| 5233 | 5233 | |
| 5234 | - $more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->';  | 
                                                        |
| 5234 | + $more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->';  | 
                                                        |
| 5235 | 5235 | $formconfirm = '';  | 
                                                        
| 5236 | 5236 | $inputok = array();  | 
                                                        
| 5237 | 5237 | $inputko = array();  | 
                                                        
@@ -5255,27 +5255,27 @@ discard block  | 
                                                    ||
| 5255 | 5255 |  			foreach ($formquestion as $key => $input) { | 
                                                        
| 5256 | 5256 |  				if (is_array($input) && !empty($input)) { | 
                                                        
| 5257 | 5257 |  					if ($input['type'] == 'hidden') { | 
                                                        
| 5258 | - $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');  | 
                                                        |
| 5259 | - $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');  | 
                                                        |
| 5258 | + $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');  | 
                                                        |
| 5259 | + $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');  | 
                                                        |
| 5260 | 5260 | |
| 5261 | - $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";  | 
                                                        |
| 5261 | + $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";  | 
                                                        |
| 5262 | 5262 | }  | 
                                                        
| 5263 | 5263 | }  | 
                                                        
| 5264 | 5264 | }  | 
                                                        
| 5265 | 5265 | |
| 5266 | 5266 | // Now add questions  | 
                                                        
| 5267 | 5267 | $moreonecolumn = '';  | 
                                                        
| 5268 | - $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n";  | 
                                                        |
| 5268 | + $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";  | 
                                                        |
| 5269 | 5269 |  			foreach ($formquestion as $key => $input) { | 
                                                        
| 5270 | 5270 |  				if (is_array($input) && !empty($input)) { | 
                                                        
| 5271 | - $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); // deprecated. Use morecss instead.  | 
                                                        |
| 5272 | - $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');  | 
                                                        |
| 5273 | - $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');  | 
                                                        |
| 5271 | + $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.  | 
                                                        |
| 5272 | + $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');  | 
                                                        |
| 5273 | + $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');  | 
                                                        |
| 5274 | 5274 | |
| 5275 | 5275 |  					if ($input['type'] == 'text') { | 
                                                        
| 5276 | -						$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"; | 
                                                        |
| 5276 | +						$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"; | 
                                                        |
| 5277 | 5277 |  					} elseif ($input['type'] == 'password') { | 
                                                        
| 5278 | -						$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"; | 
                                                        |
| 5278 | +						$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"; | 
                                                        |
| 5279 | 5279 |  					} elseif ($input['type'] == 'textarea') { | 
                                                        
| 5280 | 5280 |  						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; | 
                                                        
| 5281 | 5281 | $more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';  | 
                                                        
@@ -5283,8 +5283,8 @@ discard block  | 
                                                    ||
| 5283 | 5283 | $more .= '</textarea>';  | 
                                                        
| 5284 | 5284 | $more .= '</div></div>'."\n";*/  | 
                                                        
| 5285 | 5285 | $moreonecolumn .= '<div class="margintoponly">';  | 
                                                        
| 5286 | - $moreonecolumn .= $input['label'] . '<br>';  | 
                                                        |
| 5287 | - $moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>';  | 
                                                        |
| 5286 | + $moreonecolumn .= $input['label'].'<br>';  | 
                                                        |
| 5287 | + $moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';  | 
                                                        |
| 5288 | 5288 | $moreonecolumn .= $input['value'];  | 
                                                        
| 5289 | 5289 | $moreonecolumn .= '</textarea>';  | 
                                                        
| 5290 | 5290 | $moreonecolumn .= '</div>';  | 
                                                        
@@ -5301,20 +5301,20 @@ discard block  | 
                                                    ||
| 5301 | 5301 | $disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;  | 
                                                        
| 5302 | 5302 | $sort = isset($input['select_sort']) ? $input['select_sort'] : '';  | 
                                                        
| 5303 | 5303 | |
| 5304 | -						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; | 
                                                        |
| 5304 | +						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; | 
                                                        |
| 5305 | 5305 |  						if (!empty($input['label'])) { | 
                                                        
| 5306 | - $more .= $input['label'] . '</div><div class="tagtd left">';  | 
                                                        |
| 5306 | + $more .= $input['label'].'</div><div class="tagtd left">';  | 
                                                        |
| 5307 | 5307 | }  | 
                                                        
| 5308 | 5308 |  						if ($input['type'] == 'select') { | 
                                                        
| 5309 | 5309 | $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);  | 
                                                        
| 5310 | 5310 |  						} else { | 
                                                        
| 5311 | 5311 | $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);  | 
                                                        
| 5312 | 5312 | }  | 
                                                        
| 5313 | - $more .= '</div></div>' . "\n";  | 
                                                        |
| 5313 | + $more .= '</div></div>'."\n";  | 
                                                        |
| 5314 | 5314 |  					} elseif ($input['type'] == 'checkbox') { | 
                                                        
| 5315 | 5315 | $more .= '<div class="tagtr">';  | 
                                                        
| 5316 | -						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; | 
                                                        |
| 5317 | - $more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr;  | 
                                                        |
| 5316 | +						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; | 
                                                        |
| 5317 | + $more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;  | 
                                                        |
| 5318 | 5318 |  						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { | 
                                                        
| 5319 | 5319 | $more .= ' checked';  | 
                                                        
| 5320 | 5320 | }  | 
                                                        
@@ -5325,19 +5325,19 @@ discard block  | 
                                                    ||
| 5325 | 5325 | $more .= ' disabled';  | 
                                                        
| 5326 | 5326 | }  | 
                                                        
| 5327 | 5327 | $more .= ' /></div>';  | 
                                                        
| 5328 | - $more .= '</div>' . "\n";  | 
                                                        |
| 5328 | + $more .= '</div>'."\n";  | 
                                                        |
| 5329 | 5329 |  					} elseif ($input['type'] == 'radio') { | 
                                                        
| 5330 | 5330 | $i = 0;  | 
                                                        
| 5331 | 5331 |  						foreach ($input['values'] as $selkey => $selval) { | 
                                                        
| 5332 | 5332 | $more .= '<div class="tagtr">';  | 
                                                        
| 5333 | 5333 |  							if (isset($input['label'])) { | 
                                                        
| 5334 | 5334 |  								if ($i == 0) { | 
                                                        
| 5335 | -									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; | 
                                                        |
| 5335 | +									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; | 
                                                        |
| 5336 | 5336 |  								} else { | 
                                                        
| 5337 | -									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; | 
                                                        |
| 5337 | +									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; | 
                                                        |
| 5338 | 5338 | }  | 
                                                        
| 5339 | 5339 | }  | 
                                                        
| 5340 | - $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;  | 
                                                        |
| 5340 | + $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;  | 
                                                        |
| 5341 | 5341 |  							if (!empty($input['disabled'])) { | 
                                                        
| 5342 | 5342 | $more .= ' disabled';  | 
                                                        
| 5343 | 5343 | }  | 
                                                        
@@ -5345,12 +5345,12 @@ discard block  | 
                                                    ||
| 5345 | 5345 | $more .= ' checked="checked"';  | 
                                                        
| 5346 | 5346 | }  | 
                                                        
| 5347 | 5347 | $more .= ' /> ';  | 
                                                        
| 5348 | - $more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>';  | 
                                                        |
| 5349 | - $more .= '</div></div>' . "\n";  | 
                                                        |
| 5348 | + $more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';  | 
                                                        |
| 5349 | + $more .= '</div></div>'."\n";  | 
                                                        |
| 5350 | 5350 | $i++;  | 
                                                        
| 5351 | 5351 | }  | 
                                                        
| 5352 | 5352 |  					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { | 
                                                        
| 5353 | -						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; | 
                                                        |
| 5353 | +						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; | 
                                                        |
| 5354 | 5354 | $more .= '<div class="tagtd">';  | 
                                                        
| 5355 | 5355 | $addnowlink = (empty($input['datenow']) ? 0 : 1);  | 
                                                        
| 5356 | 5356 | $h = $m = 0;  | 
                                                        
@@ -5368,24 +5368,24 @@ discard block  | 
                                                    ||
| 5368 | 5368 |  					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not | 
                                                        
| 5369 | 5369 |  						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; | 
                                                        
| 5370 | 5370 |  						if (!empty($input['label'])) { | 
                                                        
| 5371 | - $more .= $input['label'] . '</div><div class="tagtd">';  | 
                                                        |
| 5371 | + $more .= $input['label'].'</div><div class="tagtd">';  | 
                                                        |
| 5372 | 5372 | }  | 
                                                        
| 5373 | 5373 | $more .= $input['value'];  | 
                                                        
| 5374 | - $more .= '</div></div>' . "\n";  | 
                                                        |
| 5374 | + $more .= '</div></div>'."\n";  | 
                                                        |
| 5375 | 5375 |  					} elseif ($input['type'] == 'onecolumn') { | 
                                                        
| 5376 | 5376 | $moreonecolumn .= '<div class="margintoponly">';  | 
                                                        
| 5377 | 5377 | $moreonecolumn .= $input['value'];  | 
                                                        
| 5378 | - $moreonecolumn .= '</div>' . "\n";  | 
                                                        |
| 5378 | + $moreonecolumn .= '</div>'."\n";  | 
                                                        |
| 5379 | 5379 |  					} elseif ($input['type'] == 'hidden') { | 
                                                        
| 5380 | 5380 | // Do nothing more, already added by a previous loop  | 
                                                        
| 5381 | 5381 |  					} elseif ($input['type'] == 'separator') { | 
                                                        
| 5382 | 5382 | $more .= '<br>';  | 
                                                        
| 5383 | 5383 |  					} else { | 
                                                        
| 5384 | - $more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type';  | 
                                                        |
| 5384 | + $more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';  | 
                                                        |
| 5385 | 5385 | }  | 
                                                        
| 5386 | 5386 | }  | 
                                                        
| 5387 | 5387 | }  | 
                                                        
| 5388 | - $more .= '</div>' . "\n";  | 
                                                        |
| 5388 | + $more .= '</div>'."\n";  | 
                                                        |
| 5389 | 5389 | $more .= $moreonecolumn;  | 
                                                        
| 5390 | 5390 | }  | 
                                                        
| 5391 | 5391 | |
@@ -5407,10 +5407,10 @@ discard block  | 
                                                    ||
| 5407 | 5407 | $button = $useajax;  | 
                                                        
| 5408 | 5408 | $useajax = 1;  | 
                                                        
| 5409 | 5409 | $autoOpen = false;  | 
                                                        
| 5410 | - $dialogconfirm .= '-' . $button;  | 
                                                        |
| 5410 | + $dialogconfirm .= '-'.$button;  | 
                                                        |
| 5411 | 5411 | }  | 
                                                        
| 5412 | -			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; | 
                                                        |
| 5413 | -			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); | 
                                                        |
| 5412 | +			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; | 
                                                        |
| 5413 | +			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); | 
                                                        |
| 5414 | 5414 | |
| 5415 | 5415 | // Add input fields into list of fields to read during submit (inputok and inputko)  | 
                                                        
| 5416 | 5416 |  			if (is_array($formquestion)) { | 
                                                        
@@ -5432,24 +5432,24 @@ discard block  | 
                                                    ||
| 5432 | 5432 | }  | 
                                                        
| 5433 | 5433 | |
| 5434 | 5434 | // Show JQuery confirm box.  | 
                                                        
| 5435 | - $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';  | 
                                                        |
| 5435 | + $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';  | 
                                                        |
| 5436 | 5436 |  			if (is_array($formquestion) && !empty($formquestion['text'])) { | 
                                                        
| 5437 | - $formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n";  | 
                                                        |
| 5437 | + $formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";  | 
                                                        |
| 5438 | 5438 | }  | 
                                                        
| 5439 | 5439 |  			if (!empty($more)) { | 
                                                        
| 5440 | - $formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n";  | 
                                                        |
| 5440 | + $formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n";  | 
                                                        |
| 5441 | 5441 | }  | 
                                                        
| 5442 | -			$formconfirm .= ($question ? '<div class="confirmmessage">' . img_help('', '') . ' ' . $question . '</div>' : ''); | 
                                                        |
| 5443 | - $formconfirm .= '</div>' . "\n";  | 
                                                        |
| 5442 | +			$formconfirm .= ($question ? '<div class="confirmmessage">'.img_help('', '').' '.$question.'</div>' : ''); | 
                                                        |
| 5443 | + $formconfirm .= '</div>'."\n";  | 
                                                        |
| 5444 | 5444 | |
| 5445 | - $formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n";  | 
                                                        |
| 5446 | - $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";  | 
                                                        |
| 5445 | + $formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";  | 
                                                        |
| 5446 | + $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";  | 
                                                        |
| 5447 | 5447 |  			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; | 
                                                        
| 5448 | 5448 |  			$formconfirm .= 'jQuery(document).ready(function() { | 
                                                        
| 5449 | 5449 |              $(function() { | 
                                                        
| 5450 | - $( "#' . $dialogconfirm . '" ).dialog(  | 
                                                        |
| 5450 | + $( "#' . $dialogconfirm.'" ).dialog(  | 
                                                        |
| 5451 | 5451 |              	{ | 
                                                        
| 5452 | - autoOpen: ' . ($autoOpen ? "true" : "false") . ',';  | 
                                                        |
| 5452 | + autoOpen: ' . ($autoOpen ? "true" : "false").',';  | 
                                                        |
| 5453 | 5453 |  			if ($newselectedchoice == 'no') { | 
                                                        
| 5454 | 5454 | $formconfirm .= '  | 
                                                        
| 5455 | 5455 |  						open: function() { | 
                                                        
@@ -5459,24 +5459,24 @@ discard block  | 
                                                    ||
| 5459 | 5459 | |
| 5460 | 5460 | $jsforcursor = '';  | 
                                                        
| 5461 | 5461 |  			if ($useajax == 1) { | 
                                                        
| 5462 | - $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n";  | 
                                                        |
| 5463 | -				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; | 
                                                        |
| 5462 | + $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";  | 
                                                        |
| 5463 | +				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; | 
                                                        |
| 5464 | 5464 | }  | 
                                                        
| 5465 | 5465 | |
| 5466 | 5466 | $postconfirmas = 'GET';  | 
                                                        
| 5467 | 5467 | |
| 5468 | 5468 | $formconfirm .= '  | 
                                                        
| 5469 | 5469 | resizable: false,  | 
                                                        
| 5470 | - height: "' . $height . '",  | 
                                                        |
| 5471 | - width: "' . $width . '",  | 
                                                        |
| 5470 | + height: "' . $height.'",  | 
                                                        |
| 5471 | + width: "' . $width.'",  | 
                                                        |
| 5472 | 5472 | modal: true,  | 
                                                        
| 5473 | 5473 | closeOnEscape: false,  | 
                                                        
| 5474 | 5474 |                      buttons: { | 
                                                        
| 5475 | -                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { | 
                                                        |
| 5476 | - var options = "token=' . urlencode(newToken()) . '";  | 
                                                        |
| 5477 | - var inputok = ' . json_encode($inputok) . '; /* List of fields into form */  | 
                                                        |
| 5478 | - var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";  | 
                                                        |
| 5479 | - var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";  | 
                                                        |
| 5475 | +                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { | 
                                                        |
| 5476 | + var options = "token=' . urlencode(newToken()).'";  | 
                                                        |
| 5477 | + var inputok = ' . json_encode($inputok).'; /* List of fields into form */  | 
                                                        |
| 5478 | + var page = "' . dol_escape_js(!empty($page) ? $page : '').'";  | 
                                                        |
| 5479 | + var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";  | 
                                                        |
| 5480 | 5480 | |
| 5481 | 5481 |                           	if (inputok.length > 0) { | 
                                                        
| 5482 | 5482 |                           		$.each(inputok, function(i, inputname) { | 
                                                        
@@ -5510,11 +5510,11 @@ discard block  | 
                                                    ||
| 5510 | 5510 | }  | 
                                                        
| 5511 | 5511 |  	                        $(this).dialog("close"); | 
                                                        
| 5512 | 5512 | },  | 
                                                        
| 5513 | -                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { | 
                                                        |
| 5514 | - var options = "token=' . urlencode(newToken()) . '";  | 
                                                        |
| 5515 | - var inputko = ' . json_encode($inputko) . '; /* List of fields into form */  | 
                                                        |
| 5516 | - var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";  | 
                                                        |
| 5517 | - var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";  | 
                                                        |
| 5513 | +                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { | 
                                                        |
| 5514 | + var options = "token=' . urlencode(newToken()).'";  | 
                                                        |
| 5515 | + var inputko = ' . json_encode($inputko).'; /* List of fields into form */  | 
                                                        |
| 5516 | + var page = "' . dol_escape_js(!empty($page) ? $page : '').'";  | 
                                                        |
| 5517 | + var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";  | 
                                                        |
| 5518 | 5518 |                           	if (inputko.length > 0) { | 
                                                        
| 5519 | 5519 |                           		$.each(inputko, function(i, inputname) { | 
                                                        
| 5520 | 5520 | var more = "";  | 
                                                        
@@ -5546,10 +5546,10 @@ discard block  | 
                                                    ||
| 5546 | 5546 | }  | 
                                                        
| 5547 | 5547 | );  | 
                                                        
| 5548 | 5548 | |
| 5549 | - var button = "' . $button . '";  | 
                                                        |
| 5549 | + var button = "' . $button.'";  | 
                                                        |
| 5550 | 5550 |              	if (button.length > 0) { | 
                                                        
| 5551 | 5551 |                  	$( "#" + button ).click(function() { | 
                                                        
| 5552 | -                		$("#' . $dialogconfirm . '").dialog("open"); | 
                                                        |
| 5552 | +                		$("#' . $dialogconfirm.'").dialog("open"); | 
                                                        |
| 5553 | 5553 | });  | 
                                                        
| 5554 | 5554 | }  | 
                                                        
| 5555 | 5555 | });  | 
                                                        
@@ -5557,44 +5557,44 @@ discard block  | 
                                                    ||
| 5557 | 5557 | </script>';  | 
                                                        
| 5558 | 5558 | $formconfirm .= "<!-- end ajax formconfirm -->\n";  | 
                                                        
| 5559 | 5559 |  		} else { | 
                                                        
| 5560 | - $formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n";  | 
                                                        |
| 5560 | + $formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n";  | 
                                                        |
| 5561 | 5561 | |
| 5562 | 5562 |  			if (empty($disableformtag)) { | 
                                                        
| 5563 | - $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";  | 
                                                        |
| 5563 | + $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";  | 
                                                        |
| 5564 | 5564 | }  | 
                                                        
| 5565 | 5565 | |
| 5566 | - $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";  | 
                                                        |
| 5567 | - $formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n";  | 
                                                        |
| 5566 | + $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";  | 
                                                        |
| 5567 | + $formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";  | 
                                                        |
| 5568 | 5568 | |
| 5569 | - $formconfirm .= '<table class="valid centpercent">' . "\n";  | 
                                                        |
| 5569 | + $formconfirm .= '<table class="valid centpercent">'."\n";  | 
                                                        |
| 5570 | 5570 | |
| 5571 | 5571 | // Line title  | 
                                                        
| 5572 | 5572 | $formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">';  | 
                                                        
| 5573 | -			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; | 
                                                        |
| 5574 | - $formconfirm .= '</td></tr>' . "\n";  | 
                                                        |
| 5573 | +			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title; | 
                                                        |
| 5574 | + $formconfirm .= '</td></tr>'."\n";  | 
                                                        |
| 5575 | 5575 | |
| 5576 | 5576 | // Line text  | 
                                                        
| 5577 | 5577 |  			if (is_array($formquestion) && !empty($formquestion['text'])) { | 
                                                        
| 5578 | - $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";  | 
                                                        |
| 5578 | + $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n";  | 
                                                        |
| 5579 | 5579 | }  | 
                                                        
| 5580 | 5580 | |
| 5581 | 5581 | // Line form fields  | 
                                                        
| 5582 | 5582 |  			if ($more) { | 
                                                        
| 5583 | - $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n";  | 
                                                        |
| 5583 | + $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n";  | 
                                                        |
| 5584 | 5584 | $formconfirm .= $more;  | 
                                                        
| 5585 | - $formconfirm .= '</td></tr>' . "\n";  | 
                                                        |
| 5585 | + $formconfirm .= '</td></tr>'."\n";  | 
                                                        |
| 5586 | 5586 | }  | 
                                                        
| 5587 | 5587 | |
| 5588 | 5588 | // Line with question  | 
                                                        
| 5589 | 5589 | $formconfirm .= '<tr class="valid">';  | 
                                                        
| 5590 | - $formconfirm .= '<td class="valid">' . $question . '</td>';  | 
                                                        |
| 5590 | + $formconfirm .= '<td class="valid">'.$question.'</td>';  | 
                                                        |
| 5591 | 5591 | $formconfirm .= '<td class="valid center">';  | 
                                                        
| 5592 | 5592 |  			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); | 
                                                        
| 5593 | -			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; | 
                                                        |
| 5593 | +			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; | 
                                                        |
| 5594 | 5594 | $formconfirm .= '</td>';  | 
                                                        
| 5595 | - $formconfirm .= '</tr>' . "\n";  | 
                                                        |
| 5595 | + $formconfirm .= '</tr>'."\n";  | 
                                                        |
| 5596 | 5596 | |
| 5597 | - $formconfirm .= '</table>' . "\n";  | 
                                                        |
| 5597 | + $formconfirm .= '</table>'."\n";  | 
                                                        |
| 5598 | 5598 | |
| 5599 | 5599 |  			if (empty($disableformtag)) { | 
                                                        
| 5600 | 5600 | $formconfirm .= "</form>\n";  | 
                                                        
@@ -5603,7 +5603,7 @@ discard block  | 
                                                    ||
| 5603 | 5603 | |
| 5604 | 5604 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 5605 | 5605 | $formconfirm .= '<!-- code to disable button to avoid double clic -->';  | 
                                                        
| 5606 | - $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";  | 
                                                        |
| 5606 | + $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";  | 
                                                        |
| 5607 | 5607 | $formconfirm .= '  | 
                                                        
| 5608 | 5608 |  				$(document).ready(function () { | 
                                                        
| 5609 | 5609 |  					$(".confirmvalidatebutton").on("click", function() { | 
                                                        
@@ -5615,7 +5615,7 @@ discard block  | 
                                                    ||
| 5615 | 5615 | });  | 
                                                        
| 5616 | 5616 | });  | 
                                                        
| 5617 | 5617 | ';  | 
                                                        
| 5618 | - $formconfirm .= '</script>' . "\n";  | 
                                                        |
| 5618 | + $formconfirm .= '</script>'."\n";  | 
                                                        |
| 5619 | 5619 | }  | 
                                                        
| 5620 | 5620 | |
| 5621 | 5621 | $formconfirm .= "<!-- end formconfirm -->\n";  | 
                                                        
@@ -5647,8 +5647,8 @@ discard block  | 
                                                    ||
| 5647 | 5647 | // phpcs:enable  | 
                                                        
| 5648 | 5648 | global $langs;  | 
                                                        
| 5649 | 5649 | |
| 5650 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';  | 
                                                        |
| 5651 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';  | 
                                                        |
| 5650 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';  | 
                                                        |
| 5651 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';  | 
                                                        |
| 5652 | 5652 | |
| 5653 | 5653 | $out = '';  | 
                                                        
| 5654 | 5654 | |
@@ -5656,11 +5656,11 @@ discard block  | 
                                                    ||
| 5656 | 5656 | |
| 5657 | 5657 |  		$langs->load("project"); | 
                                                        
| 5658 | 5658 |  		if ($htmlname != "none") { | 
                                                        
| 5659 | - $out .= '<form method="post" action="' . $page . '">';  | 
                                                        |
| 5659 | + $out .= '<form method="post" action="'.$page.'">';  | 
                                                        |
| 5660 | 5660 | $out .= '<input type="hidden" name="action" value="classin">';  | 
                                                        
| 5661 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5661 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5662 | 5662 | $out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss);  | 
                                                        
| 5663 | -			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5663 | +			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5664 | 5664 | $out .= '</form>';  | 
                                                        
| 5665 | 5665 |  		} else { | 
                                                        
| 5666 | 5666 | $out .= '<span class="project_head_block">';  | 
                                                        
@@ -5669,7 +5669,7 @@ discard block  | 
                                                    ||
| 5669 | 5669 | $projet->fetch($selected);  | 
                                                        
| 5670 | 5670 | $out .= $projet->getNomUrl(0, '', 1);  | 
                                                        
| 5671 | 5671 |  			} else { | 
                                                        
| 5672 | - $out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';  | 
                                                        |
| 5672 | + $out .= '<span class="opacitymedium">'.$textifnoproject.'</span>';  | 
                                                        |
| 5673 | 5673 | }  | 
                                                        
| 5674 | 5674 | $out .= '</span>';  | 
                                                        
| 5675 | 5675 | }  | 
                                                        
@@ -5706,14 +5706,14 @@ discard block  | 
                                                    ||
| 5706 | 5706 | $out = '';  | 
                                                        
| 5707 | 5707 | |
| 5708 | 5708 |  		if ($htmlname != "none") { | 
                                                        
| 5709 | - $out .= '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5709 | + $out .= '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5710 | 5710 | $out .= '<input type="hidden" name="action" value="setconditions">';  | 
                                                        
| 5711 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5711 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5712 | 5712 |  			if ($type) { | 
                                                        
| 5713 | - $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        |
| 5713 | + $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        |
| 5714 | 5714 | }  | 
                                                        
| 5715 | 5715 | $out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);  | 
                                                        
| 5716 | -			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5716 | +			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5717 | 5717 | $out .= '</form>';  | 
                                                        
| 5718 | 5718 |  		} else { | 
                                                        
| 5719 | 5719 |  			if ($selected) { | 
                                                        
@@ -5758,12 +5758,12 @@ discard block  | 
                                                    ||
| 5758 | 5758 | // phpcs:enable  | 
                                                        
| 5759 | 5759 | global $langs;  | 
                                                        
| 5760 | 5760 |  		if ($htmlname != "none") { | 
                                                        
| 5761 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 5761 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 5762 | 5762 | print '<input type="hidden" name="action" value="setavailability">';  | 
                                                        
| 5763 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5763 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5764 | 5764 | $this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty);  | 
                                                        
| 5765 | -			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5766 | -			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; | 
                                                        |
| 5765 | +			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5766 | +			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; | 
                                                        |
| 5767 | 5767 | print '</form>';  | 
                                                        
| 5768 | 5768 |  		} else { | 
                                                        
| 5769 | 5769 |  			if ($selected) { | 
                                                        
@@ -5789,11 +5789,11 @@ discard block  | 
                                                    ||
| 5789 | 5789 |  	{ | 
                                                        
| 5790 | 5790 | global $langs;  | 
                                                        
| 5791 | 5791 |  		if ($htmlname != "none") { | 
                                                        
| 5792 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 5792 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 5793 | 5793 | print '<input type="hidden" name="action" value="setdemandreason">';  | 
                                                        
| 5794 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5794 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5795 | 5795 | $this->selectInputReason($selected, $htmlname, -1, $addempty);  | 
                                                        
| 5796 | -			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5796 | +			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5797 | 5797 | print '</form>';  | 
                                                        
| 5798 | 5798 |  		} else { | 
                                                        
| 5799 | 5799 |  			if ($selected) { | 
                                                        
@@ -5833,17 +5833,17 @@ discard block  | 
                                                    ||
| 5833 | 5833 | $ret = '';  | 
                                                        
| 5834 | 5834 | |
| 5835 | 5835 |  		if ($htmlname != "none") { | 
                                                        
| 5836 | - $ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';  | 
                                                        |
| 5837 | - $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';  | 
                                                        |
| 5838 | - $ret .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5836 | + $ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';  | 
                                                        |
| 5837 | + $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';  | 
                                                        |
| 5838 | + $ret .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5839 | 5839 |  			if ($type) { | 
                                                        
| 5840 | - $ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        |
| 5840 | + $ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        |
| 5841 | 5841 | }  | 
                                                        
| 5842 | 5842 | $ret .= '<table class="nobordernopadding">';  | 
                                                        
| 5843 | 5843 | $ret .= '<tr><td>';  | 
                                                        
| 5844 | - $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);  | 
                                                        |
| 5844 | + $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);  | 
                                                        |
| 5845 | 5845 | $ret .= '</td>';  | 
                                                        
| 5846 | -			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; | 
                                                        |
| 5846 | +			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; | 
                                                        |
| 5847 | 5847 | $ret .= '</tr></table></form>';  | 
                                                        
| 5848 | 5848 |  		} else { | 
                                                        
| 5849 | 5849 |  			if ($displayhour) { | 
                                                        
@@ -5878,15 +5878,15 @@ discard block  | 
                                                    ||
| 5878 | 5878 | global $langs;  | 
                                                        
| 5879 | 5879 | |
| 5880 | 5880 |  		if ($htmlname != "none") { | 
                                                        
| 5881 | - print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';  | 
                                                        |
| 5882 | - print '<input type="hidden" name="action" value="set' . $htmlname . '">';  | 
                                                        |
| 5883 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5881 | + print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';  | 
                                                        |
| 5882 | + print '<input type="hidden" name="action" value="set'.$htmlname.'">';  | 
                                                        |
| 5883 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5884 | 5884 | print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);  | 
                                                        
| 5885 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5885 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5886 | 5886 | print '</form>';  | 
                                                        
| 5887 | 5887 |  		} else { | 
                                                        
| 5888 | 5888 |  			if ($selected) { | 
                                                        
| 5889 | - require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';  | 
                                                        |
| 5889 | + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';  | 
                                                        |
| 5890 | 5890 | $theuser = new User($this->db);  | 
                                                        
| 5891 | 5891 | $theuser->fetch($selected);  | 
                                                        
| 5892 | 5892 | print $theuser->getNomUrl(1);  | 
                                                        
@@ -5919,14 +5919,14 @@ discard block  | 
                                                    ||
| 5919 | 5919 | |
| 5920 | 5920 | $out = '';  | 
                                                        
| 5921 | 5921 |  		if ($htmlname != "none") { | 
                                                        
| 5922 | - $out .= '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5922 | + $out .= '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5923 | 5923 | $out .= '<input type="hidden" name="action" value="setmode">';  | 
                                                        
| 5924 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5924 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5925 | 5925 |  			if ($type) { | 
                                                        
| 5926 | - $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        |
| 5926 | + $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        |
| 5927 | 5927 | }  | 
                                                        
| 5928 | 5928 | $out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);  | 
                                                        
| 5929 | -			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5929 | +			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5930 | 5930 | $out .= '</form>';  | 
                                                        
| 5931 | 5931 |  		} else { | 
                                                        
| 5932 | 5932 |  			if ($selected) { | 
                                                        
@@ -5959,11 +5959,11 @@ discard block  | 
                                                    ||
| 5959 | 5959 |  	{ | 
                                                        
| 5960 | 5960 | global $langs;  | 
                                                        
| 5961 | 5961 |  		if ($htmlname != "none") { | 
                                                        
| 5962 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5962 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5963 | 5963 | print '<input type="hidden" name="action" value="settransportmode">';  | 
                                                        
| 5964 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5964 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5965 | 5965 | $this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);  | 
                                                        
| 5966 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5966 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5967 | 5967 | print '</form>';  | 
                                                        
| 5968 | 5968 |  		} else { | 
                                                        
| 5969 | 5969 |  			if ($selected) { | 
                                                        
@@ -5990,11 +5990,11 @@ discard block  | 
                                                    ||
| 5990 | 5990 | // phpcs:enable  | 
                                                        
| 5991 | 5991 | global $langs;  | 
                                                        
| 5992 | 5992 |  		if ($htmlname != "none") { | 
                                                        
| 5993 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5993 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5994 | 5994 | print '<input type="hidden" name="action" value="setmulticurrencycode">';  | 
                                                        
| 5995 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5995 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5996 | 5996 | print $this->selectMultiCurrency($selected, $htmlname, 0);  | 
                                                        
| 5997 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5997 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5998 | 5998 | print '</form>';  | 
                                                        
| 5999 | 5999 |  		} else { | 
                                                        
| 6000 | 6000 |  			dol_include_once('/core/lib/company.lib.php'); | 
                                                        
@@ -6019,21 +6019,21 @@ discard block  | 
                                                    ||
| 6019 | 6019 | global $langs, $mysoc, $conf;  | 
                                                        
| 6020 | 6020 | |
| 6021 | 6021 |  		if ($htmlname != "none") { | 
                                                        
| 6022 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 6022 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 6023 | 6023 | print '<input type="hidden" name="action" value="setmulticurrencyrate">';  | 
                                                        
| 6024 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6025 | - print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> ';  | 
                                                        |
| 6024 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6025 | + print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';  | 
                                                        |
| 6026 | 6026 | print '<select name="calculation_mode">';  | 
                                                        
| 6027 | -			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; | 
                                                        |
| 6028 | -			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; | 
                                                        |
| 6027 | +			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; | 
                                                        |
| 6028 | +			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; | 
                                                        |
| 6029 | 6029 | print '</select> ';  | 
                                                        
| 6030 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6030 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6031 | 6031 | print '</form>';  | 
                                                        
| 6032 | 6032 |  		} else { | 
                                                        
| 6033 | 6033 |  			if (!empty($rate)) { | 
                                                        
| 6034 | 6034 | print price($rate, 1, $langs, 1, 0);  | 
                                                        
| 6035 | 6035 |  				if ($currency && $rate != 1) { | 
                                                        
| 6036 | -					print '   (' . price($rate, 1, $langs, 1, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')'; | 
                                                        |
| 6036 | +					print '   ('.price($rate, 1, $langs, 1, 0).' '.$currency.' = 1 '.$conf->currency.')'; | 
                                                        |
| 6037 | 6037 | }  | 
                                                        
| 6038 | 6038 |  			} else { | 
                                                        
| 6039 | 6039 | print 1;  | 
                                                        
@@ -6064,9 +6064,9 @@ discard block  | 
                                                    ||
| 6064 | 6064 | // phpcs:enable  | 
                                                        
| 6065 | 6065 | global $conf, $langs;  | 
                                                        
| 6066 | 6066 |  		if ($htmlname != "none") { | 
                                                        
| 6067 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 6067 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 6068 | 6068 | print '<input type="hidden" name="action" value="setabsolutediscount">';  | 
                                                        
| 6069 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6069 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6070 | 6070 | print '<div class="inline-block">';  | 
                                                        
| 6071 | 6071 |  			if (!empty($discount_type)) { | 
                                                        
| 6072 | 6072 |  				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { | 
                                                        
@@ -6104,24 +6104,24 @@ discard block  | 
                                                    ||
| 6104 | 6104 | print '</div>';  | 
                                                        
| 6105 | 6105 |  			if (empty($hidelist)) { | 
                                                        
| 6106 | 6106 | print '<div class="inline-block" style="padding-right: 10px">';  | 
                                                        
| 6107 | - $newfilter = 'discount_type=' . intval($discount_type);  | 
                                                        |
| 6107 | + $newfilter = 'discount_type='.intval($discount_type);  | 
                                                        |
| 6108 | 6108 |  				if (!empty($discount_type)) { | 
                                                        
| 6109 | 6109 | $newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available  | 
                                                        
| 6110 | 6110 |  				} else { | 
                                                        
| 6111 | 6111 | $newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available  | 
                                                        
| 6112 | 6112 | }  | 
                                                        
| 6113 | 6113 |  				if ($filter) { | 
                                                        
| 6114 | -					$newfilter .= ' AND (' . $filter . ')'; | 
                                                        |
| 6114 | +					$newfilter .= ' AND ('.$filter.')'; | 
                                                        |
| 6115 | 6115 | }  | 
                                                        
| 6116 | 6116 | // output the combo of discounts  | 
                                                        
| 6117 | 6117 | $nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue);  | 
                                                        
| 6118 | 6118 |  				if ($nbqualifiedlines > 0) { | 
                                                        
| 6119 | -					print '   <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; | 
                                                        |
| 6119 | +					print '   <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; | 
                                                        |
| 6120 | 6120 |  					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { | 
                                                        
| 6121 | -						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; | 
                                                        |
| 6121 | +						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; | 
                                                        |
| 6122 | 6122 | }  | 
                                                        
| 6123 | 6123 |  					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { | 
                                                        
| 6124 | -						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; | 
                                                        |
| 6124 | +						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; | 
                                                        |
| 6125 | 6125 | }  | 
                                                        
| 6126 | 6126 | |
| 6127 | 6127 | print '>';  | 
                                                        
@@ -6161,23 +6161,23 @@ discard block  | 
                                                    ||
| 6161 | 6161 | global $langs, $conf;  | 
                                                        
| 6162 | 6162 | |
| 6163 | 6163 |  		if ($htmlname != "none") { | 
                                                        
| 6164 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 6164 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 6165 | 6165 | print '<input type="hidden" name="action" value="set_contact">';  | 
                                                        
| 6166 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6166 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6167 | 6167 | print '<table class="nobordernopadding">';  | 
                                                        
| 6168 | 6168 | print '<tr><td>';  | 
                                                        
| 6169 | 6169 | print $this->selectcontacts($societe->id, $selected, $htmlname);  | 
                                                        
| 6170 | 6170 | $num = $this->num;  | 
                                                        
| 6171 | 6171 |  			if ($num == 0) { | 
                                                        
| 6172 | 6172 |  				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); | 
                                                        
| 6173 | - print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>';  | 
                                                        |
| 6173 | + print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>';  | 
                                                        |
| 6174 | 6174 | }  | 
                                                        
| 6175 | 6175 | print '</td>';  | 
                                                        
| 6176 | -			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; | 
                                                        |
| 6176 | +			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; | 
                                                        |
| 6177 | 6177 | print '</tr></table></form>';  | 
                                                        
| 6178 | 6178 |  		} else { | 
                                                        
| 6179 | 6179 |  			if ($selected) { | 
                                                        
| 6180 | - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';  | 
                                                        |
| 6180 | + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';  | 
                                                        |
| 6181 | 6181 | $contact = new Contact($this->db);  | 
                                                        
| 6182 | 6182 | $contact->fetch($selected);  | 
                                                        
| 6183 | 6183 | print $contact->getFullName($langs);  | 
                                                        
@@ -6212,20 +6212,20 @@ discard block  | 
                                                    ||
| 6212 | 6212 | |
| 6213 | 6213 | $out = '';  | 
                                                        
| 6214 | 6214 |  		if ($htmlname != "none") { | 
                                                        
| 6215 | - $out .= '<form method="post" action="' . $page . '">';  | 
                                                        |
| 6215 | + $out .= '<form method="post" action="'.$page.'">';  | 
                                                        |
| 6216 | 6216 | $out .= '<input type="hidden" name="action" value="set_thirdparty">';  | 
                                                        
| 6217 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6217 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6218 | 6218 | $out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids);  | 
                                                        
| 6219 | -			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6219 | +			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6220 | 6220 | $out .= '</form>';  | 
                                                        
| 6221 | 6221 |  		} else { | 
                                                        
| 6222 | 6222 |  			if ($selected) { | 
                                                        
| 6223 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        |
| 6223 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        |
| 6224 | 6224 | $soc = new Societe($this->db);  | 
                                                        
| 6225 | 6225 | $soc->fetch($selected);  | 
                                                        
| 6226 | 6226 | $out .= $soc->getNomUrl(0, '');  | 
                                                        
| 6227 | 6227 |  			} else { | 
                                                        
| 6228 | - $out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';  | 
                                                        |
| 6228 | + $out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';  | 
                                                        |
| 6229 | 6229 | }  | 
                                                        
| 6230 | 6230 | }  | 
                                                        
| 6231 | 6231 | |
@@ -6275,22 +6275,22 @@ discard block  | 
                                                    ||
| 6275 | 6275 | $selected = 'EUR'; // Pour compatibilite  | 
                                                        
| 6276 | 6276 | }  | 
                                                        
| 6277 | 6277 | |
| 6278 | - $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 6278 | + $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 6279 | 6279 |  		if ($useempty) { | 
                                                        
| 6280 | 6280 | $out .= '<option value="-1" selected></option>';  | 
                                                        
| 6281 | 6281 | }  | 
                                                        
| 6282 | 6282 |  		foreach ($langs->cache_currencies as $code_iso => $currency) { | 
                                                        
| 6283 | 6283 | $labeltoshow = $currency['label'];  | 
                                                        
| 6284 | 6284 |  			if ($mode == 1) { | 
                                                        
| 6285 | -				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; | 
                                                        |
| 6285 | +				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; | 
                                                        |
| 6286 | 6286 |  			} else { | 
                                                        
| 6287 | -				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; | 
                                                        |
| 6287 | +				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; | 
                                                        |
| 6288 | 6288 | }  | 
                                                        
| 6289 | 6289 | |
| 6290 | 6290 |  			if ($selected && $selected == $code_iso) { | 
                                                        
| 6291 | - $out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">';  | 
                                                        |
| 6291 | + $out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';  | 
                                                        |
| 6292 | 6292 |  			} else { | 
                                                        
| 6293 | - $out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">';  | 
                                                        |
| 6293 | + $out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';  | 
                                                        |
| 6294 | 6294 | }  | 
                                                        
| 6295 | 6295 | $out .= $labeltoshow;  | 
                                                        
| 6296 | 6296 | $out .= '</option>';  | 
                                                        
@@ -6301,7 +6301,7 @@ discard block  | 
                                                    ||
| 6301 | 6301 | }  | 
                                                        
| 6302 | 6302 | |
| 6303 | 6303 | // Make select dynamic  | 
                                                        
| 6304 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 6304 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 6305 | 6305 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 6306 | 6306 | |
| 6307 | 6307 | return $out;  | 
                                                        
@@ -6327,10 +6327,10 @@ discard block  | 
                                                    ||
| 6327 | 6327 | |
| 6328 | 6328 | $TCurrency = array();  | 
                                                        
| 6329 | 6329 | |
| 6330 | - $sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";  | 
                                                        |
| 6331 | -		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; | 
                                                        |
| 6330 | + $sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";  | 
                                                        |
| 6331 | +		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; | 
                                                        |
| 6332 | 6332 |  		if ($filter) { | 
                                                        
| 6333 | - $sql .= " AND " . $filter;  | 
                                                        |
| 6333 | + $sql .= " AND ".$filter;  | 
                                                        |
| 6334 | 6334 | }  | 
                                                        
| 6335 | 6335 | $resql = $this->db->query($sql);  | 
                                                        
| 6336 | 6336 |  		if ($resql) { | 
                                                        
@@ -6340,7 +6340,7 @@ discard block  | 
                                                    ||
| 6340 | 6340 | }  | 
                                                        
| 6341 | 6341 | |
| 6342 | 6342 | $out = '';  | 
                                                        
| 6343 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 6343 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 6344 | 6344 |  		if ($useempty) { | 
                                                        
| 6345 | 6345 | $out .= '<option value=""> </option>';  | 
                                                        
| 6346 | 6346 | }  | 
                                                        
@@ -6352,13 +6352,13 @@ discard block  | 
                                                    ||
| 6352 | 6352 |  			foreach ($langs->cache_currencies as $code_iso => $currency) { | 
                                                        
| 6353 | 6353 |  				if (isset($TCurrency[$code_iso])) { | 
                                                        
| 6354 | 6354 |  					if (!empty($selected) && $selected == $code_iso) { | 
                                                        
| 6355 | - $out .= '<option value="' . $code_iso . '" selected="selected">';  | 
                                                        |
| 6355 | + $out .= '<option value="'.$code_iso.'" selected="selected">';  | 
                                                        |
| 6356 | 6356 |  					} else { | 
                                                        
| 6357 | - $out .= '<option value="' . $code_iso . '">';  | 
                                                        |
| 6357 | + $out .= '<option value="'.$code_iso.'">';  | 
                                                        |
| 6358 | 6358 | }  | 
                                                        
| 6359 | 6359 | |
| 6360 | 6360 | $out .= $currency['label'];  | 
                                                        
| 6361 | -					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; | 
                                                        |
| 6361 | +					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; | 
                                                        |
| 6362 | 6362 | $out .= '</option>';  | 
                                                        
| 6363 | 6363 | }  | 
                                                        
| 6364 | 6364 | }  | 
                                                        
@@ -6367,7 +6367,7 @@ discard block  | 
                                                    ||
| 6367 | 6367 | $out .= '</select>';  | 
                                                        
| 6368 | 6368 | |
| 6369 | 6369 | // Make select dynamic  | 
                                                        
| 6370 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 6370 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 6371 | 6371 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 6372 | 6372 | |
| 6373 | 6373 | return $out;  | 
                                                        
@@ -6398,7 +6398,7 @@ discard block  | 
                                                    ||
| 6398 | 6398 | $sql .= " WHERE t.fk_pays = c.rowid";  | 
                                                        
| 6399 | 6399 | $sql .= " AND t.active > 0";  | 
                                                        
| 6400 | 6400 |  		$sql .= " AND t.entity IN (".getEntity('c_tva').")"; | 
                                                        
| 6401 | -		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; | 
                                                        |
| 6401 | +		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; | 
                                                        |
| 6402 | 6402 | $sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";  | 
                                                        
| 6403 | 6403 | |
| 6404 | 6404 | $resql = $this->db->query($sql);  | 
                                                        
@@ -6410,30 +6410,30 @@ discard block  | 
                                                    ||
| 6410 | 6410 | |
| 6411 | 6411 | $tmparray = array();  | 
                                                        
| 6412 | 6412 | $tmparray['rowid'] = $obj->rowid;  | 
                                                        
| 6413 | - $tmparray['type_vat'] = $obj->type_vat;  | 
                                                        |
| 6414 | - $tmparray['code'] = $obj->code;  | 
                                                        |
| 6413 | + $tmparray['type_vat'] = $obj->type_vat;  | 
                                                        |
| 6414 | + $tmparray['code'] = $obj->code;  | 
                                                        |
| 6415 | 6415 | $tmparray['txtva'] = $obj->taux;  | 
                                                        
| 6416 | - $tmparray['nprtva'] = $obj->recuperableonly;  | 
                                                        |
| 6416 | + $tmparray['nprtva'] = $obj->recuperableonly;  | 
                                                        |
| 6417 | 6417 | $tmparray['localtax1'] = $obj->localtax1;  | 
                                                        
| 6418 | 6418 | $tmparray['localtax1_type'] = $obj->localtax1_type;  | 
                                                        
| 6419 | 6419 | $tmparray['localtax2'] = $obj->localtax2;  | 
                                                        
| 6420 | 6420 | $tmparray['localtax2_type'] = $obj->localtax1_type;  | 
                                                        
| 6421 | -					$tmparray['label']			= $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * | 
                                                        |
| 6422 | -					$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 | 
                                                        |
| 6421 | +					$tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * | 
                                                        |
| 6422 | +					$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 | 
                                                        |
| 6423 | 6423 | $positiverates = '';  | 
                                                        
| 6424 | 6424 |  					if ($obj->taux) { | 
                                                        
| 6425 | - $positiverates .= ($positiverates ? '/' : '') . $obj->taux;  | 
                                                        |
| 6425 | + $positiverates .= ($positiverates ? '/' : '').$obj->taux;  | 
                                                        |
| 6426 | 6426 | }  | 
                                                        
| 6427 | 6427 |  					if ($obj->localtax1) { | 
                                                        
| 6428 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;  | 
                                                        |
| 6428 | + $positiverates .= ($positiverates ? '/' : '').$obj->localtax1;  | 
                                                        |
| 6429 | 6429 | }  | 
                                                        
| 6430 | 6430 |  					if ($obj->localtax2) { | 
                                                        
| 6431 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;  | 
                                                        |
| 6431 | + $positiverates .= ($positiverates ? '/' : '').$obj->localtax2;  | 
                                                        |
| 6432 | 6432 | }  | 
                                                        
| 6433 | 6433 |  					if (empty($positiverates)) { | 
                                                        
| 6434 | 6434 | $positiverates = '0';  | 
                                                        
| 6435 | 6435 | }  | 
                                                        
| 6436 | -					$tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label | 
                                                        |
| 6436 | +					$tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label | 
                                                        |
| 6437 | 6437 | |
| 6438 | 6438 | $this->cache_vatrates[$obj->rowid] = $tmparray;  | 
                                                        
| 6439 | 6439 | }  | 
                                                        
@@ -6453,7 +6453,7 @@ discard block  | 
                                                    ||
| 6453 | 6453 | return -1;  | 
                                                        
| 6454 | 6454 | }  | 
                                                        
| 6455 | 6455 |  		} else { | 
                                                        
| 6456 | - $this->error = '<span class="error">' . $this->db->error() . '</span>';  | 
                                                        |
| 6456 | + $this->error = '<span class="error">'.$this->db->error().'</span>';  | 
                                                        |
| 6457 | 6457 | return -2;  | 
                                                        
| 6458 | 6458 | }  | 
                                                        
| 6459 | 6459 | }  | 
                                                        
@@ -6506,9 +6506,9 @@ discard block  | 
                                                    ||
| 6506 | 6506 | // Check parameters  | 
                                                        
| 6507 | 6507 |  		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { | 
                                                        
| 6508 | 6508 |  			if ($societe_vendeuse->id == $mysoc->id) { | 
                                                        
| 6509 | -				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; | 
                                                        |
| 6509 | +				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; | 
                                                        |
| 6510 | 6510 |  			} else { | 
                                                        
| 6511 | -				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; | 
                                                        |
| 6511 | +				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; | 
                                                        |
| 6512 | 6512 | }  | 
                                                        
| 6513 | 6513 | return $return;  | 
                                                        
| 6514 | 6514 | }  | 
                                                        
@@ -6520,12 +6520,12 @@ discard block  | 
                                                    ||
| 6520 | 6520 | // Define list of countries to use to search VAT rates to show  | 
                                                        
| 6521 | 6521 | // First we defined code_country to use to find list  | 
                                                        
| 6522 | 6522 |  		if (is_object($societe_vendeuse)) { | 
                                                        
| 6523 | - $code_country = "'" . $societe_vendeuse->country_code . "'";  | 
                                                        |
| 6523 | + $code_country = "'".$societe_vendeuse->country_code."'";  | 
                                                        |
| 6524 | 6524 |  		} else { | 
                                                        
| 6525 | - $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente  | 
                                                        |
| 6525 | + $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente  | 
                                                        |
| 6526 | 6526 | }  | 
                                                        
| 6527 | 6527 |  		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on | 
                                                        
| 6528 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 6528 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 6529 | 6529 | // If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries  | 
                                                        
| 6530 | 6530 | // If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country  | 
                                                        
| 6531 | 6531 |  			$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); | 
                                                        
@@ -6535,27 +6535,27 @@ discard block  | 
                                                    ||
| 6535 | 6535 |  					if ($type == 1) { // We know product is a service | 
                                                        
| 6536 | 6536 |  						switch ($selectVatComboMode) { | 
                                                        
| 6537 | 6537 | case '1':  | 
                                                        
| 6538 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6538 | + $code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6539 | 6539 | break;  | 
                                                        
| 6540 | 6540 | case '2':  | 
                                                        
| 6541 | - $code_country = "'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6541 | + $code_country = "'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6542 | 6542 | break;  | 
                                                        
| 6543 | 6543 | }  | 
                                                        
| 6544 | 6544 | }  | 
                                                        
| 6545 | 6545 |  				} elseif (!$idprod) {  // We don't know type of product | 
                                                        
| 6546 | 6546 |  					switch ($selectVatComboMode) { | 
                                                        
| 6547 | 6547 | case '1':  | 
                                                        
| 6548 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6548 | + $code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6549 | 6549 | break;  | 
                                                        
| 6550 | 6550 | case '2':  | 
                                                        
| 6551 | - $code_country = "'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6551 | + $code_country = "'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6552 | 6552 | break;  | 
                                                        
| 6553 | 6553 | }  | 
                                                        
| 6554 | 6554 |  				} else { | 
                                                        
| 6555 | 6555 | $prodstatic = new Product($this->db);  | 
                                                        
| 6556 | 6556 | $prodstatic->fetch($idprod);  | 
                                                        
| 6557 | 6557 |  					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service | 
                                                        
| 6558 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6558 | + $code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6559 | 6559 | }  | 
                                                        
| 6560 | 6560 | }  | 
                                                        
| 6561 | 6561 | }  | 
                                                        
@@ -6617,13 +6617,13 @@ discard block  | 
                                                    ||
| 6617 | 6617 | // Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead  | 
                                                        
| 6618 | 6618 | // of using supplier invoices (this is a very bad idea !)  | 
                                                        
| 6619 | 6619 |  				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { | 
                                                        
| 6620 | -					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; | 
                                                        |
| 6620 | +					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; | 
                                                        |
| 6621 | 6621 | $disabled = true;  | 
                                                        
| 6622 | 6622 | }  | 
                                                        
| 6623 | 6623 | }  | 
                                                        
| 6624 | 6624 | |
| 6625 | 6625 |  			if (!$options_only) { | 
                                                        
| 6626 | - $return .= '<select class="flat minwidth50imp maxwidth100" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';  | 
                                                        |
| 6626 | + $return .= '<select class="flat minwidth50imp maxwidth100" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';  | 
                                                        |
| 6627 | 6627 | }  | 
                                                        
| 6628 | 6628 | |
| 6629 | 6629 | $selectedfound = false;  | 
                                                        
@@ -6637,13 +6637,13 @@ discard block  | 
                                                    ||
| 6637 | 6637 | $key = $rate['txtva'];  | 
                                                        
| 6638 | 6638 | $key .= $rate['nprtva'] ? '*' : '';  | 
                                                        
| 6639 | 6639 |  				if ($mode > 0 && $rate['code']) { | 
                                                        
| 6640 | -					$key .= ' (' . $rate['code'] . ')'; | 
                                                        |
| 6640 | +					$key .= ' ('.$rate['code'].')'; | 
                                                        |
| 6641 | 6641 | }  | 
                                                        
| 6642 | 6642 |  				if ($mode < 0) { | 
                                                        
| 6643 | 6643 | $key = $rate['rowid'];  | 
                                                        
| 6644 | 6644 | }  | 
                                                        
| 6645 | 6645 | |
| 6646 | - $return .= '<option value="' . $key . '"';  | 
                                                        |
| 6646 | + $return .= '<option value="'.$key.'"';  | 
                                                        |
| 6647 | 6647 |  				if (!$selectedfound) { | 
                                                        
| 6648 | 6648 |  					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag | 
                                                        
| 6649 | 6649 |  						if ($defaultcode == $rate['code']) { | 
                                                        
@@ -6714,7 +6714,7 @@ discard block  | 
                                                    ||
| 6714 | 6714 | 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 = '')  | 
                                                        
| 6715 | 6715 |  	{ | 
                                                        
| 6716 | 6716 | // phpcs:enable  | 
                                                        
| 6717 | - dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);  | 
                                                        |
| 6717 | + dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);  | 
                                                        |
| 6718 | 6718 | $retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof);  | 
                                                        
| 6719 | 6719 |  		if (!empty($nooutput)) { | 
                                                        
| 6720 | 6720 | return $retstring;  | 
                                                        
@@ -6743,11 +6743,11 @@ discard block  | 
                                                    ||
| 6743 | 6743 |  	{ | 
                                                        
| 6744 | 6744 | global $langs;  | 
                                                        
| 6745 | 6745 | |
| 6746 | -		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); | 
                                                        |
| 6746 | +		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); | 
                                                        |
| 6747 | 6747 |  		if ($forcenewline) { | 
                                                        
| 6748 | 6748 | $ret .= '<br>';  | 
                                                        
| 6749 | 6749 | }  | 
                                                        
| 6750 | -		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); | 
                                                        |
| 6750 | +		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); | 
                                                        |
| 6751 | 6751 | return $ret;  | 
                                                        
| 6752 | 6752 | }  | 
                                                        
| 6753 | 6753 | |
@@ -6813,7 +6813,7 @@ discard block  | 
                                                    ||
| 6813 | 6813 | $orig_set_time = $set_time;  | 
                                                        
| 6814 | 6814 | |
| 6815 | 6815 |  		if ($set_time === '' && $emptydate == 0) { | 
                                                        
| 6816 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';  | 
                                                        |
| 6816 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';  | 
                                                        |
| 6817 | 6817 |  			if ($gm == 'tzuser' || $gm == 'tzuserrel') { | 
                                                        
| 6818 | 6818 | $set_time = dol_now($gm);  | 
                                                        
| 6819 | 6819 |  			} else { | 
                                                        
@@ -6881,38 +6881,38 @@ discard block  | 
                                                    ||
| 6881 | 6881 | // Calendrier popup version eldy  | 
                                                        
| 6882 | 6882 |  				if ($usecalendar == "eldy") { | 
                                                        
| 6883 | 6883 | // Input area to enter date manually  | 
                                                        
| 6884 | - $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate" maxlength="11" value="' . $formated_date . '"';  | 
                                                        |
| 6884 | + $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';  | 
                                                        |
| 6885 | 6885 | $retstring .= ($disabled ? ' disabled' : '');  | 
                                                        
| 6886 | -					$retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 6886 | +					$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 6887 | 6887 | $retstring .= '>';  | 
                                                        
| 6888 | 6888 | |
| 6889 | 6889 | // Icon calendar  | 
                                                        
| 6890 | 6890 | $retstringbuttom = '';  | 
                                                        
| 6891 | 6891 |  					if (!$disabled) { | 
                                                        
| 6892 | - $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';  | 
                                                        |
| 6893 | - $base = DOL_URL_ROOT . '/core/';  | 
                                                        |
| 6894 | -						$retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; | 
                                                        |
| 6895 | -						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        |
| 6892 | + $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';  | 
                                                        |
| 6893 | + $base = DOL_URL_ROOT.'/core/';  | 
                                                        |
| 6894 | +						$retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; | 
                                                        |
| 6895 | +						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        |
| 6896 | 6896 |  					} else { | 
                                                        
| 6897 | -						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        |
| 6897 | +						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        |
| 6898 | 6898 | }  | 
                                                        
| 6899 | - $retstring = $retstringbuttom . $retstring;  | 
                                                        |
| 6899 | + $retstring = $retstringbuttom.$retstring;  | 
                                                        |
| 6900 | 6900 | |
| 6901 | - $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n";  | 
                                                        |
| 6902 | - $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";  | 
                                                        |
| 6903 | - $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n";  | 
                                                        |
| 6901 | + $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";  | 
                                                        |
| 6902 | + $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";  | 
                                                        |
| 6903 | + $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";  | 
                                                        |
| 6904 | 6904 |  				} elseif ($usecalendar == 'jquery') { | 
                                                        
| 6905 | 6905 |  					if (!$disabled) { | 
                                                        
| 6906 | 6906 | // Output javascript for datepicker  | 
                                                        
| 6907 | 6907 |  						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (date('Y') - 100)); | 
                                                        
| 6908 | 6908 |  						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (date('Y') + 100)); | 
                                                        
| 6909 | 6909 | |
| 6910 | - $retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">';  | 
                                                        |
| 6911 | -						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ | 
                                                        |
| 6912 | -							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', | 
                                                        |
| 6910 | + $retstring .= '<script nonce="'.getNonce().'" type="text/javascript">';  | 
                                                        |
| 6911 | +						$retstring .= "$(function(){ $('#".$prefix."').datepicker({ | 
                                                        |
| 6912 | +							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', | 
                                                        |
| 6913 | 6913 | autoclose: true,  | 
                                                        
| 6914 | 6914 | todayHighlight: true,  | 
                                                        
| 6915 | - yearRange: '" . $minYear . ":" . $maxYear . "',";  | 
                                                        |
| 6915 | + yearRange: '" . $minYear.":".$maxYear."',";  | 
                                                        |
| 6916 | 6916 |  						if (!empty($conf->dol_use_jmobile)) { | 
                                                        
| 6917 | 6917 | $retstring .= "  | 
                                                        
| 6918 | 6918 |  								beforeShow: function (input, datePicker) { | 
                                                        
@@ -6927,7 +6927,7 @@ discard block  | 
                                                    ||
| 6927 | 6927 |  						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { | 
                                                        
| 6928 | 6928 | $retstring .= "  | 
                                                        
| 6929 | 6929 | showOn: 'button', /* both has problem with autocompletion */  | 
                                                        
| 6930 | - buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png',  | 
                                                        |
| 6930 | + buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png',  | 
                                                        |
| 6931 | 6931 | buttonImageOnly: true";  | 
                                                        
| 6932 | 6932 | }  | 
                                                        
| 6933 | 6933 | $retstring .= "  | 
                                                        
@@ -6939,8 +6939,8 @@ discard block  | 
                                                    ||
| 6939 | 6939 | $retstring .= '<div class="nowraponall inline-block divfordateinput">';  | 
                                                        
| 6940 | 6940 | $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';  | 
                                                        
| 6941 | 6941 | $retstring .= ($disabled ? ' disabled' : '');  | 
                                                        
| 6942 | - $retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');  | 
                                                        |
| 6943 | -					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 6942 | + $retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');  | 
                                                        |
| 6943 | +					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 6944 | 6944 | $retstring .= '>';  | 
                                                        
| 6945 | 6945 | |
| 6946 | 6946 | // Icone calendrier  | 
                                                        
@@ -6955,40 +6955,40 @@ discard block  | 
                                                    ||
| 6955 | 6955 | $retstring.='});';  | 
                                                        
| 6956 | 6956 | $retstring.="</script>";*/  | 
                                                        
| 6957 | 6957 |  					} else { | 
                                                        
| 6958 | -						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        |
| 6959 | - $retsring = $retstringbutton . $retstring;  | 
                                                        |
| 6958 | +						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        |
| 6959 | + $retsring = $retstringbutton.$retstring;  | 
                                                        |
| 6960 | 6960 | }  | 
                                                        
| 6961 | 6961 | |
| 6962 | 6962 | $retstring .= '</div>';  | 
                                                        
| 6963 | - $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n";  | 
                                                        |
| 6964 | - $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";  | 
                                                        |
| 6965 | - $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n";  | 
                                                        |
| 6963 | + $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";  | 
                                                        |
| 6964 | + $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";  | 
                                                        |
| 6965 | + $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";  | 
                                                        |
| 6966 | 6966 |  				} else { | 
                                                        
| 6967 | 6967 | $retstring .= "Bad value of MAIN_POPUP_CALENDAR";  | 
                                                        
| 6968 | 6968 | }  | 
                                                        
| 6969 | 6969 |  			} else { | 
                                                        
| 6970 | 6970 | // Show date with combo selects  | 
                                                        
| 6971 | 6971 | // Day  | 
                                                        
| 6972 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';  | 
                                                        |
| 6972 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';  | 
                                                        |
| 6973 | 6973 | |
| 6974 | 6974 |  				if ($emptydate || $set_time == -1) { | 
                                                        
| 6975 | 6975 | $retstring .= '<option value="0" selected> </option>';  | 
                                                        
| 6976 | 6976 | }  | 
                                                        
| 6977 | 6977 | |
| 6978 | 6978 |  				for ($day = 1; $day <= 31; $day++) { | 
                                                        
| 6979 | - $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';  | 
                                                        |
| 6979 | + $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';  | 
                                                        |
| 6980 | 6980 | }  | 
                                                        
| 6981 | 6981 | |
| 6982 | 6982 | $retstring .= "</select>";  | 
                                                        
| 6983 | 6983 | |
| 6984 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';  | 
                                                        |
| 6984 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';  | 
                                                        |
| 6985 | 6985 |  				if ($emptydate || $set_time == -1) { | 
                                                        
| 6986 | 6986 | $retstring .= '<option value="0" selected> </option>';  | 
                                                        
| 6987 | 6987 | }  | 
                                                        
| 6988 | 6988 | |
| 6989 | 6989 | // Month  | 
                                                        
| 6990 | 6990 |  				for ($month = 1; $month <= 12; $month++) { | 
                                                        
| 6991 | - $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';  | 
                                                        |
| 6991 | + $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';  | 
                                                        |
| 6992 | 6992 | $retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");  | 
                                                        
| 6993 | 6993 | $retstring .= "</option>";  | 
                                                        
| 6994 | 6994 | }  | 
                                                        
@@ -6996,12 +6996,12 @@ discard block  | 
                                                    ||
| 6996 | 6996 | |
| 6997 | 6997 | // Year  | 
                                                        
| 6998 | 6998 |  				if ($emptydate || $set_time == -1) { | 
                                                        
| 6999 | -					$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 . '">'; | 
                                                        |
| 6999 | +					$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.'">'; | 
                                                        |
| 7000 | 7000 |  				} else { | 
                                                        
| 7001 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';  | 
                                                        |
| 7001 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';  | 
                                                        |
| 7002 | 7002 | |
| 7003 | 7003 |  					for ($year = $syear - 10; $year < $syear + 10; $year++) { | 
                                                        
| 7004 | - $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';  | 
                                                        |
| 7004 | + $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';  | 
                                                        |
| 7005 | 7005 | }  | 
                                                        
| 7006 | 7006 | $retstring .= "</select>\n";  | 
                                                        
| 7007 | 7007 | }  | 
                                                        
@@ -7025,15 +7025,15 @@ discard block  | 
                                                    ||
| 7025 | 7025 | }  | 
                                                        
| 7026 | 7026 | }  | 
                                                        
| 7027 | 7027 | // Show hour  | 
                                                        
| 7028 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';  | 
                                                        |
| 7028 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';  | 
                                                        |
| 7029 | 7029 |  			if ($emptyhours) { | 
                                                        
| 7030 | 7030 | $retstring .= '<option value="-1"> </option>';  | 
                                                        
| 7031 | 7031 | }  | 
                                                        
| 7032 | 7032 |  			for ($hour = $hourstart; $hour < $hourend; $hour++) { | 
                                                        
| 7033 | 7033 |  				if (strlen($hour) < 2) { | 
                                                        
| 7034 | - $hour = "0" . $hour;  | 
                                                        |
| 7034 | + $hour = "0".$hour;  | 
                                                        |
| 7035 | 7035 | }  | 
                                                        
| 7036 | - $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour;  | 
                                                        |
| 7036 | + $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;  | 
                                                        |
| 7037 | 7037 | //$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');  | 
                                                        
| 7038 | 7038 | $retstring .= '</option>';  | 
                                                        
| 7039 | 7039 | }  | 
                                                        
@@ -7046,19 +7046,19 @@ discard block  | 
                                                    ||
| 7046 | 7046 | |
| 7047 | 7047 |  		if ($m) { | 
                                                        
| 7048 | 7048 | // Show minutes  | 
                                                        
| 7049 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';  | 
                                                        |
| 7049 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';  | 
                                                        |
| 7050 | 7050 |  			if ($emptyhours) { | 
                                                        
| 7051 | 7051 | $retstring .= '<option value="-1"> </option>';  | 
                                                        
| 7052 | 7052 | }  | 
                                                        
| 7053 | 7053 |  			for ($min = 0; $min < 60; $min += $stepminutes) { | 
                                                        
| 7054 | 7054 |  				if (strlen($min) < 2) { | 
                                                        
| 7055 | - $min = "0" . $min;  | 
                                                        |
| 7055 | + $min = "0".$min;  | 
                                                        |
| 7056 | 7056 | }  | 
                                                        
| 7057 | - $retstring .= '<option value="' . $min . '"' . (($min == $smin) ? ' selected' : '') . '>' . $min . (empty($conf->dol_optimize_smallscreen) ? '' : '') . '</option>';  | 
                                                        |
| 7057 | + $retstring .= '<option value="'.$min.'"'.(($min == $smin) ? ' selected' : '').'>'.$min.(empty($conf->dol_optimize_smallscreen) ? '' : '').'</option>';  | 
                                                        |
| 7058 | 7058 | }  | 
                                                        
| 7059 | 7059 | $retstring .= '</select>';  | 
                                                        
| 7060 | 7060 | |
| 7061 | - $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';  | 
                                                        |
| 7061 | + $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';  | 
                                                        |
| 7062 | 7062 | }  | 
                                                        
| 7063 | 7063 | |
| 7064 | 7064 |  		if ($d && $h) { | 
                                                        
@@ -7081,10 +7081,10 @@ discard block  | 
                                                    ||
| 7081 | 7081 | |
| 7082 | 7082 | // Generate the date part, depending on the use or not of the javascript calendar  | 
                                                        
| 7083 | 7083 |  			if ($addnowlink == 1) { // server time expressed in user time setup | 
                                                        
| 7084 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';  | 
                                                        |
| 7085 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        |
| 7086 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        |
| 7087 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        |
| 7084 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';  | 
                                                        |
| 7085 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        |
| 7086 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        |
| 7087 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        |
| 7088 | 7088 |  			} elseif ($addnowlink == 2) { | 
                                                        
| 7089 | 7089 | /* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.  | 
                                                        
| 7090 | 7090 | * This break application for foreign languages.  | 
                                                        
@@ -7093,10 +7093,10 @@ discard block  | 
                                                    ||
| 7093 | 7093 | $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';  | 
                                                        
| 7094 | 7094 | $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';  | 
                                                        
| 7095 | 7095 | */  | 
                                                        
| 7096 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';  | 
                                                        |
| 7097 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        |
| 7098 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        |
| 7099 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        |
| 7096 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';  | 
                                                        |
| 7097 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        |
| 7098 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        |
| 7099 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        |
| 7100 | 7100 | }  | 
                                                        
| 7101 | 7101 | /*if ($usecalendar == "eldy")  | 
                                                        
| 7102 | 7102 |  			{ | 
                                                        
@@ -7116,11 +7116,11 @@ discard block  | 
                                                    ||
| 7116 | 7116 | }  | 
                                                        
| 7117 | 7117 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';  | 
                                                        
| 7118 | 7118 |  				if ($addnowlink == 1) { | 
                                                        
| 7119 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';  | 
                                                        |
| 7120 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';  | 
                                                        |
| 7119 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';  | 
                                                        |
| 7120 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';  | 
                                                        |
| 7121 | 7121 |  				} elseif ($addnowlink == 2) { | 
                                                        
| 7122 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());';  | 
                                                        |
| 7123 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';  | 
                                                        |
| 7122 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';  | 
                                                        |
| 7123 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';  | 
                                                        |
| 7124 | 7124 | }  | 
                                                        
| 7125 | 7125 | |
| 7126 | 7126 |  				if ($fullday) { | 
                                                        
@@ -7134,11 +7134,11 @@ discard block  | 
                                                    ||
| 7134 | 7134 | }  | 
                                                        
| 7135 | 7135 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';  | 
                                                        
| 7136 | 7136 |  				if ($addnowlink == 1) { | 
                                                        
| 7137 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';  | 
                                                        |
| 7138 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';  | 
                                                        |
| 7137 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';  | 
                                                        |
| 7138 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';  | 
                                                        |
| 7139 | 7139 |  				} elseif ($addnowlink == 2) { | 
                                                        
| 7140 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());';  | 
                                                        |
| 7141 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';  | 
                                                        |
| 7140 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';  | 
                                                        |
| 7141 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';  | 
                                                        |
| 7142 | 7142 | }  | 
                                                        
| 7143 | 7143 |  				if ($fullday) { | 
                                                        
| 7144 | 7144 | $reset_scripts .= ' } ';  | 
                                                        
@@ -7146,7 +7146,7 @@ discard block  | 
                                                    ||
| 7146 | 7146 | }  | 
                                                        
| 7147 | 7147 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick  | 
                                                        
| 7148 | 7148 |  			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { | 
                                                        
| 7149 | - $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';  | 
                                                        |
| 7149 | + $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';  | 
                                                        |
| 7150 | 7150 |  				$retstring .= $langs->trans("Now"); | 
                                                        
| 7151 | 7151 | $retstring .= '</button> ';  | 
                                                        
| 7152 | 7152 | }  | 
                                                        
@@ -7158,16 +7158,16 @@ discard block  | 
                                                    ||
| 7158 | 7158 | $reset_scripts = "";  | 
                                                        
| 7159 | 7159 | |
| 7160 | 7160 | // Generate the date part, depending on the use or not of the javascript calendar  | 
                                                        
| 7161 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');';  | 
                                                        |
| 7162 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        |
| 7163 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        |
| 7164 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        |
| 7161 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';  | 
                                                        |
| 7162 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        |
| 7163 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        |
| 7164 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        |
| 7165 | 7165 | // Update the hour part  | 
                                                        
| 7166 | 7166 |  			if ($h) { | 
                                                        
| 7167 | 7167 |  				if ($fullday) { | 
                                                        
| 7168 | 7168 |  					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; | 
                                                        
| 7169 | 7169 | }  | 
                                                        
| 7170 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';  | 
                                                        |
| 7170 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';  | 
                                                        |
| 7171 | 7171 |  				if ($fullday) { | 
                                                        
| 7172 | 7172 | $reset_scripts .= ' } ';  | 
                                                        
| 7173 | 7173 | }  | 
                                                        
@@ -7177,14 +7177,14 @@ discard block  | 
                                                    ||
| 7177 | 7177 |  				if ($fullday) { | 
                                                        
| 7178 | 7178 |  					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; | 
                                                        
| 7179 | 7179 | }  | 
                                                        
| 7180 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';  | 
                                                        |
| 7180 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';  | 
                                                        |
| 7181 | 7181 |  				if ($fullday) { | 
                                                        
| 7182 | 7182 | $reset_scripts .= ' } ';  | 
                                                        
| 7183 | 7183 | }  | 
                                                        
| 7184 | 7184 | }  | 
                                                        
| 7185 | 7185 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick  | 
                                                        
| 7186 | 7186 |  			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { | 
                                                        
| 7187 | - $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';  | 
                                                        |
| 7187 | + $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';  | 
                                                        |
| 7188 | 7188 |  				$retstring .= $langs->trans("DateStartPlusOne"); | 
                                                        
| 7189 | 7189 | $retstring .= '</button> ';  | 
                                                        
| 7190 | 7190 | }  | 
                                                        
@@ -7242,17 +7242,17 @@ discard block  | 
                                                    ||
| 7242 | 7242 | unset($TDurationTypes[$value]);  | 
                                                        
| 7243 | 7243 | }  | 
                                                        
| 7244 | 7244 | |
| 7245 | - $retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">';  | 
                                                        |
| 7245 | + $retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';  | 
                                                        |
| 7246 | 7246 |  		foreach ($TDurationTypes as $key => $typeduration) { | 
                                                        
| 7247 | - $retstring .= '<option value="' . $key . '"';  | 
                                                        |
| 7247 | + $retstring .= '<option value="'.$key.'"';  | 
                                                        |
| 7248 | 7248 |  			if ($key == $selected) { | 
                                                        
| 7249 | 7249 | $retstring .= " selected";  | 
                                                        
| 7250 | 7250 | }  | 
                                                        
| 7251 | - $retstring .= ">" . $typeduration . "</option>";  | 
                                                        |
| 7251 | + $retstring .= ">".$typeduration."</option>";  | 
                                                        |
| 7252 | 7252 | }  | 
                                                        
| 7253 | 7253 | $retstring .= "</select>";  | 
                                                        
| 7254 | 7254 | |
| 7255 | -		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); | 
                                                        |
| 7255 | +		$retstring .= ajax_combobox('select_'.$prefix.'type_duration'); | 
                                                        |
| 7256 | 7256 | |
| 7257 | 7257 | return $retstring;  | 
                                                        
| 7258 | 7258 | }  | 
                                                        
@@ -7284,30 +7284,30 @@ discard block  | 
                                                    ||
| 7284 | 7284 | |
| 7285 | 7285 | // Hours  | 
                                                        
| 7286 | 7286 |  		if ($iSecond != '') { | 
                                                        
| 7287 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';  | 
                                                        |
| 7287 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';  | 
                                                        |
| 7288 | 7288 | |
| 7289 | 7289 | $hourSelected = convertSecondToTime($iSecond, 'allhour');  | 
                                                        
| 7290 | 7290 | $minSelected = convertSecondToTime($iSecond, 'min');  | 
                                                        
| 7291 | 7291 | }  | 
                                                        
| 7292 | 7292 | |
| 7293 | 7293 |  		if ($typehour == 'select') { | 
                                                        
| 7294 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 7294 | + $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 7295 | 7295 |  			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours | 
                                                        
| 7296 | - $retstring .= '<option value="' . $hour . '"';  | 
                                                        |
| 7296 | + $retstring .= '<option value="'.$hour.'"';  | 
                                                        |
| 7297 | 7297 |  				if (is_numeric($hourSelected) && $hourSelected == $hour) { | 
                                                        
| 7298 | 7298 | $retstring .= " selected";  | 
                                                        
| 7299 | 7299 | }  | 
                                                        
| 7300 | - $retstring .= ">" . $hour . "</option>";  | 
                                                        |
| 7300 | + $retstring .= ">".$hour."</option>";  | 
                                                        |
| 7301 | 7301 | }  | 
                                                        
| 7302 | 7302 | $retstring .= "</select>";  | 
                                                        
| 7303 | 7303 |  		} elseif ($typehour == 'text' || $typehour == 'textselect') { | 
                                                        
| 7304 | -			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; | 
                                                        |
| 7304 | +			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; | 
                                                        |
| 7305 | 7305 |  		} else { | 
                                                        
| 7306 | 7306 | return 'BadValueForParameterTypeHour';  | 
                                                        
| 7307 | 7307 | }  | 
                                                        
| 7308 | 7308 | |
| 7309 | 7309 |  		if ($typehour != 'text') { | 
                                                        
| 7310 | -			$retstring .= ' ' . $langs->trans('HourShort'); | 
                                                        |
| 7310 | +			$retstring .= ' '.$langs->trans('HourShort'); | 
                                                        |
| 7311 | 7311 |  		} else { | 
                                                        
| 7312 | 7312 | $retstring .= '<span class="">:</span>';  | 
                                                        
| 7313 | 7313 | }  | 
                                                        
@@ -7322,21 +7322,21 @@ discard block  | 
                                                    ||
| 7322 | 7322 | }  | 
                                                        
| 7323 | 7323 | |
| 7324 | 7324 |  		if ($typehour == 'select' || $typehour == 'textselect') { | 
                                                        
| 7325 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 7325 | + $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 7326 | 7326 |  			for ($min = 0; $min <= 55; $min = $min + 5) { | 
                                                        
| 7327 | - $retstring .= '<option value="' . $min . '"';  | 
                                                        |
| 7327 | + $retstring .= '<option value="'.$min.'"';  | 
                                                        |
| 7328 | 7328 |  				if (is_numeric($minSelected) && $minSelected == $min) { | 
                                                        
| 7329 | 7329 | $retstring .= ' selected';  | 
                                                        
| 7330 | 7330 | }  | 
                                                        
| 7331 | - $retstring .= '>' . $min . '</option>';  | 
                                                        |
| 7331 | + $retstring .= '>'.$min.'</option>';  | 
                                                        |
| 7332 | 7332 | }  | 
                                                        
| 7333 | 7333 | $retstring .= "</select>";  | 
                                                        
| 7334 | 7334 |  		} elseif ($typehour == 'text') { | 
                                                        
| 7335 | -			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; | 
                                                        |
| 7335 | +			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; | 
                                                        |
| 7336 | 7336 | }  | 
                                                        
| 7337 | 7337 | |
| 7338 | 7338 |  		if ($typehour != 'text') { | 
                                                        
| 7339 | -			$retstring .= ' ' . $langs->trans('MinuteShort'); | 
                                                        |
| 7339 | +			$retstring .= ' '.$langs->trans('MinuteShort'); | 
                                                        |
| 7340 | 7340 | }  | 
                                                        
| 7341 | 7341 | |
| 7342 | 7342 | $retstring .= "</span>";  | 
                                                        
@@ -7384,7 +7384,7 @@ discard block  | 
                                                    ||
| 7384 | 7384 | $placeholder = '';  | 
                                                        
| 7385 | 7385 | |
| 7386 | 7386 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 7387 | - require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';  | 
                                                        |
| 7387 | + require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';  | 
                                                        |
| 7388 | 7388 | $tickettmpselect = new Ticket($this->db);  | 
                                                        
| 7389 | 7389 | $tickettmpselect->fetch($selected);  | 
                                                        
| 7390 | 7390 | $selected_input_value = $tickettmpselect->ref;  | 
                                                        
@@ -7392,17 +7392,17 @@ discard block  | 
                                                    ||
| 7392 | 7392 | }  | 
                                                        
| 7393 | 7393 | |
| 7394 | 7394 | $urloption = '';  | 
                                                        
| 7395 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7395 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7396 | 7396 | |
| 7397 | 7397 |  			if (empty($hidelabel)) { | 
                                                        
| 7398 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 7398 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 7399 | 7399 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 7400 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 7400 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 7401 | 7401 |  				if ($hidelabel == 2) { | 
                                                        
| 7402 | 7402 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7403 | 7403 | }  | 
                                                        
| 7404 | 7404 | }  | 
                                                        
| 7405 | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 7405 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 7406 | 7406 |  			if ($hidelabel == 3) { | 
                                                        
| 7407 | 7407 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7408 | 7408 | }  | 
                                                        
@@ -7446,8 +7446,8 @@ discard block  | 
                                                    ||
| 7446 | 7446 | |
| 7447 | 7447 | $sql = "SELECT ";  | 
                                                        
| 7448 | 7448 | $sql .= $selectFields;  | 
                                                        
| 7449 | - $sql .= " FROM " . $this->db->prefix() . "ticket as p";  | 
                                                        |
| 7450 | -		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; | 
                                                        |
| 7449 | + $sql .= " FROM ".$this->db->prefix()."ticket as p";  | 
                                                        |
| 7450 | +		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; | 
                                                        |
| 7451 | 7451 | |
| 7452 | 7452 | // Add criteria on ref/label  | 
                                                        
| 7453 | 7453 |  		if ($filterkey != '') { | 
                                                        
@@ -7463,7 +7463,7 @@ discard block  | 
                                                    ||
| 7463 | 7463 |  				if ($i > 0) { | 
                                                        
| 7464 | 7464 | $sql .= " AND ";  | 
                                                        
| 7465 | 7465 | }  | 
                                                        
| 7466 | - $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 7466 | + $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 7467 | 7467 | $sql .= ")";  | 
                                                        
| 7468 | 7468 | $i++;  | 
                                                        
| 7469 | 7469 | }  | 
                                                        
@@ -7476,22 +7476,22 @@ discard block  | 
                                                    ||
| 7476 | 7476 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 7477 | 7477 | |
| 7478 | 7478 | // Build output string  | 
                                                        
| 7479 | - dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG);  | 
                                                        |
| 7479 | + dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG);  | 
                                                        |
| 7480 | 7480 | $result = $this->db->query($sql);  | 
                                                        
| 7481 | 7481 |  		if ($result) { | 
                                                        
| 7482 | - require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';  | 
                                                        |
| 7483 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';  | 
                                                        |
| 7482 | + require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';  | 
                                                        |
| 7483 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';  | 
                                                        |
| 7484 | 7484 | |
| 7485 | 7485 | $num = $this->db->num_rows($result);  | 
                                                        
| 7486 | 7486 | |
| 7487 | 7487 | $events = null;  | 
                                                        
| 7488 | 7488 | |
| 7489 | 7489 |  			if (!$forcecombo) { | 
                                                        
| 7490 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 7490 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 7491 | 7491 | $out .= ajax_combobox($htmlname, $events, $conf->global->TICKET_USE_SEARCH_TO_SELECT);  | 
                                                        
| 7492 | 7492 | }  | 
                                                        
| 7493 | 7493 | |
| 7494 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 7494 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 7495 | 7495 | |
| 7496 | 7496 | $textifempty = '';  | 
                                                        
| 7497 | 7497 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -7508,7 +7508,7 @@ discard block  | 
                                                    ||
| 7508 | 7508 | }  | 
                                                        
| 7509 | 7509 | }  | 
                                                        
| 7510 | 7510 |  			if ($showempty) { | 
                                                        
| 7511 | - $out .= '<option value="0" selected>' . $textifempty . '</option>';  | 
                                                        |
| 7511 | + $out .= '<option value="0" selected>'.$textifempty.'</option>';  | 
                                                        |
| 7512 | 7512 | }  | 
                                                        
| 7513 | 7513 | |
| 7514 | 7514 | $i = 0;  | 
                                                        
@@ -7563,13 +7563,13 @@ discard block  | 
                                                    ||
| 7563 | 7563 | $outref = $objp->ref;  | 
                                                        
| 7564 | 7564 | $outtype = $objp->fk_product_type;  | 
                                                        
| 7565 | 7565 | |
| 7566 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 7566 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 7567 | 7567 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 7568 | 7568 | $opt .= '>';  | 
                                                        
| 7569 | 7569 | $opt .= $objp->ref;  | 
                                                        
| 7570 | 7570 | $objRef = $objp->ref;  | 
                                                        
| 7571 | 7571 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 7572 | -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7572 | +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7573 | 7573 | }  | 
                                                        
| 7574 | 7574 | |
| 7575 | 7575 | $opt .= "</option>\n";  | 
                                                        
@@ -7610,7 +7610,7 @@ discard block  | 
                                                    ||
| 7610 | 7610 | $placeholder = '';  | 
                                                        
| 7611 | 7611 | |
| 7612 | 7612 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 7613 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 7613 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 7614 | 7614 | $projecttmpselect = new Project($this->db);  | 
                                                        
| 7615 | 7615 | $projecttmpselect->fetch($selected);  | 
                                                        
| 7616 | 7616 | $selected_input_value = $projecttmpselect->ref;  | 
                                                        
@@ -7618,17 +7618,17 @@ discard block  | 
                                                    ||
| 7618 | 7618 | }  | 
                                                        
| 7619 | 7619 | |
| 7620 | 7620 | $urloption = '';  | 
                                                        
| 7621 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7621 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7622 | 7622 | |
| 7623 | 7623 |  			if (empty($hidelabel)) { | 
                                                        
| 7624 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 7624 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 7625 | 7625 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 7626 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 7626 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 7627 | 7627 |  				if ($hidelabel == 2) { | 
                                                        
| 7628 | 7628 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7629 | 7629 | }  | 
                                                        
| 7630 | 7630 | }  | 
                                                        
| 7631 | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 7631 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 7632 | 7632 |  			if ($hidelabel == 3) { | 
                                                        
| 7633 | 7633 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7634 | 7634 | }  | 
                                                        
@@ -7671,8 +7671,8 @@ discard block  | 
                                                    ||
| 7671 | 7671 | |
| 7672 | 7672 | $sql = "SELECT ";  | 
                                                        
| 7673 | 7673 | $sql .= $selectFields;  | 
                                                        
| 7674 | - $sql .= " FROM " . $this->db->prefix() . "projet as p";  | 
                                                        |
| 7675 | -		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; | 
                                                        |
| 7674 | + $sql .= " FROM ".$this->db->prefix()."projet as p";  | 
                                                        |
| 7675 | +		$sql .= ' WHERE p.entity IN ('.getEntity('project').')'; | 
                                                        |
| 7676 | 7676 | |
| 7677 | 7677 | // Add criteria on ref/label  | 
                                                        
| 7678 | 7678 |  		if ($filterkey != '') { | 
                                                        
@@ -7688,7 +7688,7 @@ discard block  | 
                                                    ||
| 7688 | 7688 |  				if ($i > 0) { | 
                                                        
| 7689 | 7689 | $sql .= " AND ";  | 
                                                        
| 7690 | 7690 | }  | 
                                                        
| 7691 | - $sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 7691 | + $sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 7692 | 7692 | $sql .= "";  | 
                                                        
| 7693 | 7693 | $i++;  | 
                                                        
| 7694 | 7694 | }  | 
                                                        
@@ -7701,22 +7701,22 @@ discard block  | 
                                                    ||
| 7701 | 7701 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 7702 | 7702 | |
| 7703 | 7703 | // Build output string  | 
                                                        
| 7704 | - dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG);  | 
                                                        |
| 7704 | + dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);  | 
                                                        |
| 7705 | 7705 | $result = $this->db->query($sql);  | 
                                                        
| 7706 | 7706 |  		if ($result) { | 
                                                        
| 7707 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 7708 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';  | 
                                                        |
| 7707 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 7708 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';  | 
                                                        |
| 7709 | 7709 | |
| 7710 | 7710 | $num = $this->db->num_rows($result);  | 
                                                        
| 7711 | 7711 | |
| 7712 | 7712 | $events = null;  | 
                                                        
| 7713 | 7713 | |
| 7714 | 7714 |  			if (!$forcecombo) { | 
                                                        
| 7715 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 7715 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 7716 | 7716 | $out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);  | 
                                                        
| 7717 | 7717 | }  | 
                                                        
| 7718 | 7718 | |
| 7719 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 7719 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 7720 | 7720 | |
| 7721 | 7721 | $textifempty = '';  | 
                                                        
| 7722 | 7722 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -7733,7 +7733,7 @@ discard block  | 
                                                    ||
| 7733 | 7733 | }  | 
                                                        
| 7734 | 7734 | }  | 
                                                        
| 7735 | 7735 |  			if ($showempty) { | 
                                                        
| 7736 | - $out .= '<option value="0" selected>' . $textifempty . '</option>';  | 
                                                        |
| 7736 | + $out .= '<option value="0" selected>'.$textifempty.'</option>';  | 
                                                        |
| 7737 | 7737 | }  | 
                                                        
| 7738 | 7738 | |
| 7739 | 7739 | $i = 0;  | 
                                                        
@@ -7791,13 +7791,13 @@ discard block  | 
                                                    ||
| 7791 | 7791 | $outlabel = $objp->label;  | 
                                                        
| 7792 | 7792 | $outtype = $objp->fk_product_type;  | 
                                                        
| 7793 | 7793 | |
| 7794 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 7794 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 7795 | 7795 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 7796 | 7796 | $opt .= '>';  | 
                                                        
| 7797 | 7797 | $opt .= $objp->ref;  | 
                                                        
| 7798 | 7798 | $objRef = $objp->ref;  | 
                                                        
| 7799 | 7799 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 7800 | -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7800 | +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7801 | 7801 | }  | 
                                                        
| 7802 | 7802 | |
| 7803 | 7803 | $opt .= "</option>\n";  | 
                                                        
@@ -7840,7 +7840,7 @@ discard block  | 
                                                    ||
| 7840 | 7840 | $urloption = '';  | 
                                                        
| 7841 | 7841 | |
| 7842 | 7842 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 7843 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';  | 
                                                        |
| 7843 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';  | 
                                                        |
| 7844 | 7844 | $adherenttmpselect = new Adherent($this->db);  | 
                                                        
| 7845 | 7845 | $adherenttmpselect->fetch($selected);  | 
                                                        
| 7846 | 7846 | $selected_input_value = $adherenttmpselect->ref;  | 
                                                        
@@ -7849,17 +7849,17 @@ discard block  | 
                                                    ||
| 7849 | 7849 | |
| 7850 | 7850 | $urloption = '';  | 
                                                        
| 7851 | 7851 | |
| 7852 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7852 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7853 | 7853 | |
| 7854 | 7854 |  			if (empty($hidelabel)) { | 
                                                        
| 7855 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 7855 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 7856 | 7856 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 7857 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 7857 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 7858 | 7858 |  				if ($hidelabel == 2) { | 
                                                        
| 7859 | 7859 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7860 | 7860 | }  | 
                                                        
| 7861 | 7861 | }  | 
                                                        
| 7862 | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 7862 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 7863 | 7863 |  			if ($hidelabel == 3) { | 
                                                        
| 7864 | 7864 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7865 | 7865 | }  | 
                                                        
@@ -7904,8 +7904,8 @@ discard block  | 
                                                    ||
| 7904 | 7904 | |
| 7905 | 7905 | $sql = "SELECT ";  | 
                                                        
| 7906 | 7906 | $sql .= $selectFields;  | 
                                                        
| 7907 | - $sql .= " FROM " . $this->db->prefix() . "adherent as p";  | 
                                                        |
| 7908 | -		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; | 
                                                        |
| 7907 | + $sql .= " FROM ".$this->db->prefix()."adherent as p";  | 
                                                        |
| 7908 | +		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; | 
                                                        |
| 7909 | 7909 | |
| 7910 | 7910 | // Add criteria on ref/label  | 
                                                        
| 7911 | 7911 |  		if ($filterkey != '') { | 
                                                        
@@ -7921,8 +7921,8 @@ discard block  | 
                                                    ||
| 7921 | 7921 |  				if ($i > 0) { | 
                                                        
| 7922 | 7922 | $sql .= " AND ";  | 
                                                        
| 7923 | 7923 | }  | 
                                                        
| 7924 | - $sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 7925 | - $sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";  | 
                                                        |
| 7924 | + $sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 7925 | + $sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";  | 
                                                        |
| 7926 | 7926 | $i++;  | 
                                                        
| 7927 | 7927 | }  | 
                                                        
| 7928 | 7928 |  			if (count($scrit) > 1) { | 
                                                        
@@ -7931,27 +7931,27 @@ discard block  | 
                                                    ||
| 7931 | 7931 | $sql .= ')';  | 
                                                        
| 7932 | 7932 | }  | 
                                                        
| 7933 | 7933 |  		if ($status != -1) { | 
                                                        
| 7934 | - $sql .= ' AND statut = ' . ((int) $status);  | 
                                                        |
| 7934 | + $sql .= ' AND statut = '.((int) $status);  | 
                                                        |
| 7935 | 7935 | }  | 
                                                        
| 7936 | 7936 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 7937 | 7937 | |
| 7938 | 7938 | // Build output string  | 
                                                        
| 7939 | - dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG);  | 
                                                        |
| 7939 | + dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);  | 
                                                        |
| 7940 | 7940 | $result = $this->db->query($sql);  | 
                                                        
| 7941 | 7941 |  		if ($result) { | 
                                                        
| 7942 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';  | 
                                                        |
| 7943 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';  | 
                                                        |
| 7942 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';  | 
                                                        |
| 7943 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';  | 
                                                        |
| 7944 | 7944 | |
| 7945 | 7945 | $num = $this->db->num_rows($result);  | 
                                                        
| 7946 | 7946 | |
| 7947 | 7947 | $events = null;  | 
                                                        
| 7948 | 7948 | |
| 7949 | 7949 |  			if (!$forcecombo) { | 
                                                        
| 7950 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 7950 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 7951 | 7951 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); | 
                                                        
| 7952 | 7952 | }  | 
                                                        
| 7953 | 7953 | |
| 7954 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 7954 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 7955 | 7955 | |
| 7956 | 7956 | $textifempty = '';  | 
                                                        
| 7957 | 7957 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -7968,7 +7968,7 @@ discard block  | 
                                                    ||
| 7968 | 7968 | }  | 
                                                        
| 7969 | 7969 | }  | 
                                                        
| 7970 | 7970 |  			if ($showempty) { | 
                                                        
| 7971 | - $out .= '<option value="-1" selected>' . $textifempty . '</option>';  | 
                                                        |
| 7971 | + $out .= '<option value="-1" selected>'.$textifempty.'</option>';  | 
                                                        |
| 7972 | 7972 | }  | 
                                                        
| 7973 | 7973 | |
| 7974 | 7974 | $i = 0;  | 
                                                        
@@ -8024,11 +8024,11 @@ discard block  | 
                                                    ||
| 8024 | 8024 | $outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname);  | 
                                                        
| 8025 | 8025 | $outtype = $objp->fk_adherent_type;  | 
                                                        
| 8026 | 8026 | |
| 8027 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 8027 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 8028 | 8028 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 8029 | 8029 | $opt .= '>';  | 
                                                        
| 8030 | 8030 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 8031 | -			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); | 
                                                        |
| 8031 | +			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); | 
                                                        |
| 8032 | 8032 | }  | 
                                                        
| 8033 | 8033 | $opt .= $outlabel;  | 
                                                        
| 8034 | 8034 | $opt .= "</option>\n";  | 
                                                        
@@ -8101,9 +8101,9 @@ discard block  | 
                                                    ||
| 8101 | 8101 | $vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);  | 
                                                        
| 8102 | 8102 | $reg = array();  | 
                                                        
| 8103 | 8103 |  			if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { | 
                                                        
| 8104 | - $InfoFieldList[4] = $reg[1]; // take the sort field  | 
                                                        |
| 8104 | + $InfoFieldList[4] = $reg[1]; // take the sort field  | 
                                                        |
| 8105 | 8105 | }  | 
                                                        
| 8106 | -			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field | 
                                                        |
| 8106 | +			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field | 
                                                        |
| 8107 | 8107 | |
| 8108 | 8108 | $classname = $InfoFieldList[0];  | 
                                                        
| 8109 | 8109 | $classpath = $InfoFieldList[1];  | 
                                                        
@@ -8134,8 +8134,8 @@ discard block  | 
                                                    ||
| 8134 | 8134 | );  | 
                                                        
| 8135 | 8135 | |
| 8136 | 8136 |  		if (!is_object($objecttmp)) { | 
                                                        
| 8137 | -			dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield, LOG_WARNING); | 
                                                        |
| 8138 | - return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield;  | 
                                                        |
| 8137 | +			dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield, LOG_WARNING); | 
                                                        |
| 8138 | + return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield;  | 
                                                        |
| 8139 | 8139 | }  | 
                                                        
| 8140 | 8140 | |
| 8141 | 8141 | //var_dump($filter);  | 
                                                        
@@ -8146,9 +8146,9 @@ discard block  | 
                                                    ||
| 8146 | 8146 |  		if ($prefixforautocompletemode == 'product') { | 
                                                        
| 8147 | 8147 | $prefixforautocompletemode = 'produit';  | 
                                                        
| 8148 | 8148 | }  | 
                                                        
| 8149 | - $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8149 | + $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8150 | 8150 | |
| 8151 | - dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);  | 
                                                        |
| 8151 | + dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG);  | 
                                                        |
| 8152 | 8152 | |
| 8153 | 8153 | // Generate the combo HTML component  | 
                                                        
| 8154 | 8154 | $out = '';  | 
                                                        
@@ -8162,13 +8162,13 @@ discard block  | 
                                                    ||
| 8162 | 8162 | }  | 
                                                        
| 8163 | 8163 | |
| 8164 | 8164 | // Set url and param to call to get json of the search results  | 
                                                        
| 8165 | - $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';  | 
                                                        |
| 8166 | - $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');  | 
                                                        |
| 8165 | + $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';  | 
                                                        |
| 8166 | + $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : '');  | 
                                                        |
| 8167 | 8167 | |
| 8168 | 8168 | // Activate the auto complete using ajax call.  | 
                                                        
| 8169 | 8169 | $out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0, array());  | 
                                                        
| 8170 | 8170 |  			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                        
| 8171 | - $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) . '"' : '') . ' />';  | 
                                                        |
| 8171 | + $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).'"' : '').' />';  | 
                                                        |
| 8172 | 8172 |  		} else { | 
                                                        
| 8173 | 8173 | // Immediate load of table record.  | 
                                                        
| 8174 | 8174 | $out .= $this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);  | 
                                                        
@@ -8208,7 +8208,7 @@ discard block  | 
                                                    ||
| 8208 | 8208 |  		if ($prefixforautocompletemode == 'societe') { | 
                                                        
| 8209 | 8209 | $prefixforautocompletemode = 'company';  | 
                                                        
| 8210 | 8210 | }  | 
                                                        
| 8211 | - $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8211 | + $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8212 | 8212 | |
| 8213 | 8213 |  		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...) | 
                                                        
| 8214 | 8214 | $tmpfieldstoshow = '';  | 
                                                        
@@ -8217,7 +8217,7 @@ discard block  | 
                                                    ||
| 8217 | 8217 | continue;  | 
                                                        
| 8218 | 8218 | }  | 
                                                        
| 8219 | 8219 |  				if (!empty($val['showoncombobox'])) { | 
                                                        
| 8220 | - $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;  | 
                                                        |
| 8220 | + $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;  | 
                                                        |
| 8221 | 8221 | }  | 
                                                        
| 8222 | 8222 | }  | 
                                                        
| 8223 | 8223 |  			if ($tmpfieldstoshow) { | 
                                                        
@@ -8245,18 +8245,18 @@ discard block  | 
                                                    ||
| 8245 | 8245 | $num = 0;  | 
                                                        
| 8246 | 8246 | |
| 8247 | 8247 | // Search data  | 
                                                        
| 8248 | - $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t";  | 
                                                        |
| 8248 | + $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t";  | 
                                                        |
| 8249 | 8249 |  		if (!empty($objecttmp->isextrafieldmanaged)) { | 
                                                        
| 8250 | - $sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object";  | 
                                                        |
| 8250 | + $sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object";  | 
                                                        |
| 8251 | 8251 | }  | 
                                                        
| 8252 | 8252 |  		if (isset($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8253 | 8253 |  			if (!is_numeric($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8254 | 8254 |  				$tmparray = explode('@', $objecttmp->ismultientitymanaged); | 
                                                        
| 8255 | - $sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0];  | 
                                                        |
| 8255 | + $sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];  | 
                                                        |
| 8256 | 8256 | }  | 
                                                        
| 8257 | 8257 |  			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { | 
                                                        
| 8258 | 8258 |  				if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 8259 | - $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";  | 
                                                        |
| 8259 | + $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";  | 
                                                        |
| 8260 | 8260 | }  | 
                                                        
| 8261 | 8261 | }  | 
                                                        
| 8262 | 8262 | }  | 
                                                        
@@ -8276,21 +8276,21 @@ discard block  | 
                                                    ||
| 8276 | 8276 | $sql .= " WHERE 1=1";  | 
                                                        
| 8277 | 8277 |  			if (isset($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8278 | 8278 |  				if ($objecttmp->ismultientitymanaged == 1) { | 
                                                        
| 8279 | -					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; | 
                                                        |
| 8279 | +					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; | 
                                                        |
| 8280 | 8280 | }  | 
                                                        
| 8281 | 8281 |  				if (!is_numeric($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8282 | - $sql .= " AND parenttable.entity = t." . $tmparray[0];  | 
                                                        |
| 8282 | + $sql .= " AND parenttable.entity = t.".$tmparray[0];  | 
                                                        |
| 8283 | 8283 | }  | 
                                                        
| 8284 | 8284 |  				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { | 
                                                        
| 8285 | 8285 |  					if ($objecttmp->element == 'societe') { | 
                                                        
| 8286 | - $sql .= " AND t.rowid = " . ((int) $user->socid);  | 
                                                        |
| 8286 | + $sql .= " AND t.rowid = ".((int) $user->socid);  | 
                                                        |
| 8287 | 8287 |  					} else { | 
                                                        
| 8288 | - $sql .= " AND t.fk_soc = " . ((int) $user->socid);  | 
                                                        |
| 8288 | + $sql .= " AND t.fk_soc = ".((int) $user->socid);  | 
                                                        |
| 8289 | 8289 | }  | 
                                                        
| 8290 | 8290 | }  | 
                                                        
| 8291 | 8291 |  				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { | 
                                                        
| 8292 | 8292 |  					if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 8293 | - $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);  | 
                                                        |
| 8293 | + $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);  | 
                                                        |
| 8294 | 8294 | }  | 
                                                        
| 8295 | 8295 | }  | 
                                                        
| 8296 | 8296 | }  | 
                                                        
@@ -8302,7 +8302,7 @@ discard block  | 
                                                    ||
| 8302 | 8302 | $errormessage = '';  | 
                                                        
| 8303 | 8303 | $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);  | 
                                                        
| 8304 | 8304 |  				if ($errormessage) { | 
                                                        
| 8305 | - return 'Error forging a SQL request from an universal criteria: ' . $errormessage;  | 
                                                        |
| 8305 | + return 'Error forging a SQL request from an universal criteria: '.$errormessage;  | 
                                                        |
| 8306 | 8306 | }  | 
                                                        
| 8307 | 8307 | }  | 
                                                        
| 8308 | 8308 | }  | 
                                                        
@@ -8314,7 +8314,7 @@ discard block  | 
                                                    ||
| 8314 | 8314 | $resql = $this->db->query($sql);  | 
                                                        
| 8315 | 8315 |  		if ($resql) { | 
                                                        
| 8316 | 8316 | // Construct $out and $outarray  | 
                                                        
| 8317 | - $out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";  | 
                                                        |
| 8317 | + $out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";  | 
                                                        |
| 8318 | 8318 | |
| 8319 | 8319 | // Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4  | 
                                                        
| 8320 | 8320 | $textifempty = ' ';  | 
                                                        
@@ -8328,7 +8328,7 @@ discard block  | 
                                                    ||
| 8328 | 8328 | }  | 
                                                        
| 8329 | 8329 | }  | 
                                                        
| 8330 | 8330 |  			if ($showempty) { | 
                                                        
| 8331 | - $out .= '<option value="-1">' . $textifempty . '</option>' . "\n";  | 
                                                        |
| 8331 | + $out .= '<option value="-1">'.$textifempty.'</option>'."\n";  | 
                                                        |
| 8332 | 8332 | }  | 
                                                        
| 8333 | 8333 | |
| 8334 | 8334 | $num = $this->db->num_rows($resql);  | 
                                                        
@@ -8351,9 +8351,9 @@ discard block  | 
                                                    ||
| 8351 | 8351 | }  | 
                                                        
| 8352 | 8352 |  					if (empty($outputmode)) { | 
                                                        
| 8353 | 8353 |  						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { | 
                                                        
| 8354 | - $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>';  | 
                                                        |
| 8354 | + $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>';  | 
                                                        |
| 8355 | 8355 |  						} else { | 
                                                        
| 8356 | - $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';  | 
                                                        |
| 8356 | + $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';  | 
                                                        |
| 8357 | 8357 | }  | 
                                                        
| 8358 | 8358 |  					} else { | 
                                                        
| 8359 | 8359 |  						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); | 
                                                        
@@ -8366,10 +8366,10 @@ discard block  | 
                                                    ||
| 8366 | 8366 | }  | 
                                                        
| 8367 | 8367 | }  | 
                                                        
| 8368 | 8368 | |
| 8369 | - $out .= '</select>' . "\n";  | 
                                                        |
| 8369 | + $out .= '</select>'."\n";  | 
                                                        |
| 8370 | 8370 | |
| 8371 | 8371 |  			if (!$forcecombo) { | 
                                                        
| 8372 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 8372 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 8373 | 8373 | $out .= ajax_combobox($htmlname, null, getDolGlobalInt($confkeyforautocompletemode, 0));  | 
                                                        
| 8374 | 8374 | }  | 
                                                        
| 8375 | 8375 |  		} else { | 
                                                        
@@ -8431,8 +8431,8 @@ discard block  | 
                                                    ||
| 8431 | 8431 | }  | 
                                                        
| 8432 | 8432 | }  | 
                                                        
| 8433 | 8433 |  		$idname = str_replace(array('[', ']'), array('', ''), $htmlname); | 
                                                        
| 8434 | -		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; | 
                                                        |
| 8435 | -		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); | 
                                                        |
| 8434 | +		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; | 
                                                        |
| 8435 | +		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); | 
                                                        |
| 8436 | 8436 | $out .= '>'."\n";  | 
                                                        
| 8437 | 8437 | |
| 8438 | 8438 |  		if ($show_empty) { | 
                                                        
@@ -8443,7 +8443,7 @@ discard block  | 
                                                    ||
| 8443 | 8443 |  			if (!is_numeric($show_empty)) { | 
                                                        
| 8444 | 8444 | $textforempty = $show_empty;  | 
                                                        
| 8445 | 8445 | }  | 
                                                        
| 8446 | - $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";  | 
                                                        |
| 8446 | + $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";  | 
                                                        |
| 8447 | 8447 | }  | 
                                                        
| 8448 | 8448 |  		if (is_array($array)) { | 
                                                        
| 8449 | 8449 | // Translate  | 
                                                        
@@ -8466,7 +8466,7 @@ discard block  | 
                                                    ||
| 8466 | 8466 |  				if (is_array($tmpvalue)) { | 
                                                        
| 8467 | 8467 | $value = $tmpvalue['label'];  | 
                                                        
| 8468 | 8468 | $disabled = empty($tmpvalue['disabled']) ? '' : ' disabled';  | 
                                                        
| 8469 | - $style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"';  | 
                                                        |
| 8469 | + $style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"';  | 
                                                        |
| 8470 | 8470 |  				} else { | 
                                                        
| 8471 | 8471 | $value = $tmpvalue;  | 
                                                        
| 8472 | 8472 | $disabled = '';  | 
                                                        
@@ -8481,9 +8481,9 @@ discard block  | 
                                                    ||
| 8481 | 8481 | }  | 
                                                        
| 8482 | 8482 |  				if ($key_in_label) { | 
                                                        
| 8483 | 8483 |  					if (empty($nohtmlescape)) { | 
                                                        
| 8484 | - $selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));  | 
                                                        |
| 8484 | + $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));  | 
                                                        |
| 8485 | 8485 |  					} else { | 
                                                        
| 8486 | - $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);  | 
                                                        |
| 8486 | + $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);  | 
                                                        |
| 8487 | 8487 | }  | 
                                                        
| 8488 | 8488 |  				} else { | 
                                                        
| 8489 | 8489 |  					if (empty($nohtmlescape)) { | 
                                                        
@@ -8495,8 +8495,8 @@ discard block  | 
                                                    ||
| 8495 | 8495 | $selectOptionValue = ' ';  | 
                                                        
| 8496 | 8496 | }  | 
                                                        
| 8497 | 8497 | }  | 
                                                        
| 8498 | - $out .= '<option value="' . $key . '"';  | 
                                                        |
| 8499 | - $out .= $style . $disabled;  | 
                                                        |
| 8498 | + $out .= '<option value="'.$key.'"';  | 
                                                        |
| 8499 | + $out .= $style.$disabled;  | 
                                                        |
| 8500 | 8500 |  				if (is_array($id)) { | 
                                                        
| 8501 | 8501 |  					if (in_array($key, $id) && !$disabled) { | 
                                                        
| 8502 | 8502 | $out .= ' selected'; // To preselect a value  | 
                                                        
@@ -8508,7 +8508,7 @@ discard block  | 
                                                    ||
| 8508 | 8508 | }  | 
                                                        
| 8509 | 8509 | }  | 
                                                        
| 8510 | 8510 |  				if ($nohtmlescape) { | 
                                                        
| 8511 | - $out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"';  | 
                                                        |
| 8511 | + $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';  | 
                                                        |
| 8512 | 8512 | }  | 
                                                        
| 8513 | 8513 |  				if (is_array($tmpvalue)) { | 
                                                        
| 8514 | 8514 |  					foreach ($tmpvalue as $keyforvalue => $valueforvalue) { | 
                                                        
@@ -8526,7 +8526,7 @@ discard block  | 
                                                    ||
| 8526 | 8526 | // Add code for jquery to use multiselect  | 
                                                        
| 8527 | 8527 |  		if ($addjscombo && $jsbeautify) { | 
                                                        
| 8528 | 8528 | // Enhance with select2  | 
                                                        
| 8529 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 8529 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 8530 | 8530 | $out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss);  | 
                                                        
| 8531 | 8531 | }  | 
                                                        
| 8532 | 8532 | |
@@ -8554,28 +8554,28 @@ discard block  | 
                                                    ||
| 8554 | 8554 | public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)  | 
                                                        
| 8555 | 8555 |  	{ | 
                                                        
| 8556 | 8556 | global $conf, $langs;  | 
                                                        
| 8557 | - global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8557 | + global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8558 | 8558 | |
| 8559 | 8559 | // TODO Use an internal dolibarr component instead of select2  | 
                                                        
| 8560 | 8560 |  		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
| 8561 | 8561 | return '';  | 
                                                        
| 8562 | 8562 | }  | 
                                                        
| 8563 | 8563 | |
| 8564 | - $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';  | 
                                                        |
| 8564 | + $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';  | 
                                                        |
| 8565 | 8565 | |
| 8566 | 8566 | $outdelayed = '';  | 
                                                        
| 8567 | 8567 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 8568 | 8568 | $tmpplugin = 'select2';  | 
                                                        
| 8569 | - $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->  | 
                                                        |
| 8570 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 8569 | + $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->  | 
                                                        |
| 8570 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 8571 | 8571 |  		    	$(document).ready(function () { | 
                                                        
| 8572 | 8572 | |
| 8573 | - ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '  | 
                                                        |
| 8573 | + ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'  | 
                                                        |
| 8574 | 8574 | |
| 8575 | -	                $(".' . $htmlname . '").select2({ | 
                                                        |
| 8575 | +	                $(".' . $htmlname.'").select2({ | 
                                                        |
| 8576 | 8576 |  				    	ajax: { | 
                                                        
| 8577 | 8577 | dir: "ltr",  | 
                                                        
| 8578 | - url: "' . $url . '",  | 
                                                        |
| 8578 | + url: "' . $url.'",  | 
                                                        |
| 8579 | 8579 | dataType: \'json\',  | 
                                                        
| 8580 | 8580 | delay: 250,  | 
                                                        
| 8581 | 8581 |  					    	data: function (params) { | 
                                                        
@@ -8602,9 +8602,9 @@ discard block  | 
                                                    ||
| 8602 | 8602 | },  | 
                                                        
| 8603 | 8603 | language: select2arrayoflanguage,  | 
                                                        
| 8604 | 8604 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */  | 
                                                        
| 8605 | - placeholder: "' . dol_escape_js($placeholder) . '",  | 
                                                        |
| 8605 | + placeholder: "' . dol_escape_js($placeholder).'",  | 
                                                        |
| 8606 | 8606 |  				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work | 
                                                        
| 8607 | - minimumInputLength: ' . ((int) $minimumInputLength) . ',  | 
                                                        |
| 8607 | + minimumInputLength: ' . ((int) $minimumInputLength).',  | 
                                                        |
| 8608 | 8608 |  				        formatResult: function (result, container, query, escapeMarkup) { | 
                                                        
| 8609 | 8609 | return escapeMarkup(result.text);  | 
                                                        
| 8610 | 8610 | },  | 
                                                        
@@ -8612,10 +8612,10 @@ discard block  | 
                                                    ||
| 8612 | 8612 | |
| 8613 | 8613 | ' . ($callurlonselect ? '  | 
                                                        
| 8614 | 8614 | /* Code to execute a GET when we select a value */  | 
                                                        
| 8615 | -	                $(".' . $htmlname . '").change(function() { | 
                                                        |
| 8616 | -				    	var selected = $(".' . $htmlname . '").val(); | 
                                                        |
| 8615 | +	                $(".' . $htmlname.'").change(function() { | 
                                                        |
| 8616 | +				    	var selected = $(".' . $htmlname.'").val(); | 
                                                        |
| 8617 | 8617 |  	                	console.log("We select in selectArrayAjax the entry "+selected) | 
                                                        
| 8618 | -				        $(".' . $htmlname . '").val("");  /* reset visible combo value */ | 
                                                        |
| 8618 | +				        $(".' . $htmlname.'").val("");  /* reset visible combo value */ | 
                                                        |
| 8619 | 8619 |  	    			    $.each( saveRemoteData, function( key, value ) { | 
                                                        
| 8620 | 8620 | if (key == selected)  | 
                                                        
| 8621 | 8621 |  	    			            { | 
                                                        
@@ -8623,7 +8623,7 @@ discard block  | 
                                                    ||
| 8623 | 8623 | location.assign(value.url);  | 
                                                        
| 8624 | 8624 | }  | 
                                                        
| 8625 | 8625 | });  | 
                                                        
| 8626 | - });' : '') . '  | 
                                                        |
| 8626 | + });' : '').'  | 
                                                        |
| 8627 | 8627 | |
| 8628 | 8628 | });  | 
                                                        
| 8629 | 8629 | </script>';  | 
                                                        
@@ -8659,14 +8659,14 @@ discard block  | 
                                                    ||
| 8659 | 8659 | public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')  | 
                                                        
| 8660 | 8660 |  	{ | 
                                                        
| 8661 | 8661 | global $conf, $langs;  | 
                                                        
| 8662 | - global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8662 | + global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8663 | 8663 | |
| 8664 | 8664 | // TODO Use an internal dolibarr component instead of select2  | 
                                                        
| 8665 | 8665 |  		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
| 8666 | 8666 | return '';  | 
                                                        
| 8667 | 8667 | }  | 
                                                        
| 8668 | 8668 | |
| 8669 | - $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';  | 
                                                        |
| 8669 | + $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';  | 
                                                        |
| 8670 | 8670 | |
| 8671 | 8671 | $formattedarrayresult = array();  | 
                                                        
| 8672 | 8672 | |
@@ -8681,20 +8681,20 @@ discard block  | 
                                                    ||
| 8681 | 8681 | $outdelayed = '';  | 
                                                        
| 8682 | 8682 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 8683 | 8683 | $tmpplugin = 'select2';  | 
                                                        
| 8684 | - $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->  | 
                                                        |
| 8685 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 8684 | + $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->  | 
                                                        |
| 8685 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 8686 | 8686 |  				$(document).ready(function () { | 
                                                        
| 8687 | - var data = ' . json_encode($formattedarrayresult) . ';  | 
                                                        |
| 8687 | + var data = ' . json_encode($formattedarrayresult).';  | 
                                                        |
| 8688 | 8688 | |
| 8689 | - ' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '  | 
                                                        |
| 8689 | + ' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'  | 
                                                        |
| 8690 | 8690 | |
| 8691 | -					$(".' . $htmlname . '").select2({ | 
                                                        |
| 8691 | +					$(".' . $htmlname.'").select2({ | 
                                                        |
| 8692 | 8692 | data: data,  | 
                                                        
| 8693 | 8693 | language: select2arrayoflanguage,  | 
                                                        
| 8694 | 8694 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */  | 
                                                        
| 8695 | - placeholder: "' . dol_escape_js($placeholder) . '",  | 
                                                        |
| 8695 | + placeholder: "' . dol_escape_js($placeholder).'",  | 
                                                        |
| 8696 | 8696 |  						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work | 
                                                        
| 8697 | - minimumInputLength: ' . $minimumInputLength . ',  | 
                                                        |
| 8697 | + minimumInputLength: ' . $minimumInputLength.',  | 
                                                        |
| 8698 | 8698 |  						formatResult: function (result, container, query, escapeMarkup) { | 
                                                        
| 8699 | 8699 | return escapeMarkup(result.text);  | 
                                                        
| 8700 | 8700 | },  | 
                                                        
@@ -8733,11 +8733,11 @@ discard block  | 
                                                    ||
| 8733 | 8733 | |
| 8734 | 8734 | ' . ($callurlonselect ? '  | 
                                                        
| 8735 | 8735 | /* Code to execute a GET when we select a value */  | 
                                                        
| 8736 | -					$(".' . $htmlname . '").change(function() { | 
                                                        |
| 8737 | -						var selected = $(".' . $htmlname . '").val(); | 
                                                        |
| 8736 | +					$(".' . $htmlname.'").change(function() { | 
                                                        |
| 8737 | +						var selected = $(".' . $htmlname.'").val(); | 
                                                        |
| 8738 | 8738 |  						console.log("We select "+selected) | 
                                                        
| 8739 | 8739 | |
| 8740 | -						$(".' . $htmlname . '").val("");  /* reset visible combo value */ | 
                                                        |
| 8740 | +						$(".' . $htmlname.'").val("");  /* reset visible combo value */ | 
                                                        |
| 8741 | 8741 |  						$.each( saveRemoteData, function( key, value ) { | 
                                                        
| 8742 | 8742 | if (key == selected)  | 
                                                        
| 8743 | 8743 |  							{ | 
                                                        
@@ -8745,7 +8745,7 @@ discard block  | 
                                                    ||
| 8745 | 8745 | location.assign(value.url);  | 
                                                        
| 8746 | 8746 | }  | 
                                                        
| 8747 | 8747 | });  | 
                                                        
| 8748 | - });' : '') . '  | 
                                                        |
| 8748 | + });' : '').'  | 
                                                        |
| 8749 | 8749 | |
| 8750 | 8750 | });  | 
                                                        
| 8751 | 8751 | </script>';  | 
                                                        
@@ -8794,7 +8794,7 @@ discard block  | 
                                                    ||
| 8794 | 8794 | $useenhancedmultiselect = 0;  | 
                                                        
| 8795 | 8795 |  		if (!empty($conf->use_javascript_ajax) && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { | 
                                                        
| 8796 | 8796 |  			if ($addjscombo) { | 
                                                        
| 8797 | - $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.  | 
                                                        |
| 8797 | + $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.  | 
                                                        |
| 8798 | 8798 | }  | 
                                                        
| 8799 | 8799 | }  | 
                                                        
| 8800 | 8800 | |
@@ -8803,7 +8803,7 @@ discard block  | 
                                                    ||
| 8803 | 8803 | // submitted to nothing.  | 
                                                        
| 8804 | 8804 | $out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">';  | 
                                                        
| 8805 | 8805 | // Output select component  | 
                                                        
| 8806 | -		$out .= '<select id="' . $htmlname . '" class="multiselect' . ($useenhancedmultiselect ? ' multiselectononeline' : '') . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n"; | 
                                                        |
| 8806 | +		$out .= '<select id="'.$htmlname.'" class="multiselect'.($useenhancedmultiselect ? ' multiselectononeline' : '').($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', $width) ? $width : $width.'px').'"' : '').'>'."\n"; | 
                                                        |
| 8807 | 8807 |  		if (is_array($array) && !empty($array)) { | 
                                                        
| 8808 | 8808 |  			if ($value_as_key) { | 
                                                        
| 8809 | 8809 | $array = array_combine($array, $array);  | 
                                                        
@@ -8824,57 +8824,57 @@ discard block  | 
                                                    ||
| 8824 | 8824 | $tmplabelhtml = empty($value['labelhtml']) ? '' : $value['labelhtml'];  | 
                                                        
| 8825 | 8825 | }  | 
                                                        
| 8826 | 8826 | $newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);  | 
                                                        
| 8827 | - $newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);  | 
                                                        |
| 8827 | + $newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);  | 
                                                        |
| 8828 | 8828 | |
| 8829 | - $out .= '<option value="' . $tmpkey . '"';  | 
                                                        |
| 8829 | + $out .= '<option value="'.$tmpkey.'"';  | 
                                                        |
| 8830 | 8830 |  					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { | 
                                                        
| 8831 | 8831 | $out .= ' selected';  | 
                                                        
| 8832 | 8832 | }  | 
                                                        
| 8833 | 8833 |  					if (!empty($tmplabelhtml)) { | 
                                                        
| 8834 | - $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';  | 
                                                        |
| 8834 | + $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';  | 
                                                        |
| 8835 | 8835 |  					} else { | 
                                                        
| 8836 | -						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; | 
                                                        |
| 8837 | - $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';  | 
                                                        |
| 8836 | +						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; | 
                                                        |
| 8837 | + $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';  | 
                                                        |
| 8838 | 8838 | }  | 
                                                        
| 8839 | 8839 | $out .= '>';  | 
                                                        
| 8840 | 8840 | $out .= dol_htmlentitiesbr($newval);  | 
                                                        
| 8841 | - $out .= '</option>' . "\n";  | 
                                                        |
| 8841 | + $out .= '</option>'."\n";  | 
                                                        |
| 8842 | 8842 | }  | 
                                                        
| 8843 | 8843 | }  | 
                                                        
| 8844 | 8844 | }  | 
                                                        
| 8845 | - $out .= '</select>' . "\n";  | 
                                                        |
| 8845 | + $out .= '</select>'."\n";  | 
                                                        |
| 8846 | 8846 | |
| 8847 | 8847 | // Add code for jquery to use multiselect  | 
                                                        
| 8848 | 8848 |  		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
| 8849 | - $out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';  | 
                                                        |
| 8850 | - $out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";  | 
                                                        |
| 8849 | + $out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';  | 
                                                        |
| 8850 | + $out .= "\n".'<script nonce="'.getNonce().'">'."\n";  | 
                                                        |
| 8851 | 8851 |  			if ($addjscombo == 1) { | 
                                                        
| 8852 | 8852 |  				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; | 
                                                        
| 8853 | -				$out .= 'function formatResult(record, container) {' . "\n"; | 
                                                        |
| 8853 | +				$out .= 'function formatResult(record, container) {'."\n"; | 
                                                        |
| 8854 | 8854 | // If property html set, we decode html entities and use this.  | 
                                                        
| 8855 | 8855 | // Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.  | 
                                                        
| 8856 | 8856 |  				$out .= '	if ($(record.element).attr("data-html") != undefined) { return htmlEntityDecodeJs($(record.element).attr("data-html")); }'."\n"; | 
                                                        
| 8857 | 8857 | $out .= ' return record.text;';  | 
                                                        
| 8858 | - $out .= '}' . "\n";  | 
                                                        |
| 8859 | -				$out .= 'function formatSelection(record) {' . "\n"; | 
                                                        |
| 8858 | + $out .= '}'."\n";  | 
                                                        |
| 8859 | +				$out .= 'function formatSelection(record) {'."\n"; | 
                                                        |
| 8860 | 8860 |  				if ($elemtype == 'category') { | 
                                                        
| 8861 | - $out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';  | 
                                                        |
| 8861 | + $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';  | 
                                                        |
| 8862 | 8862 |  				} else { | 
                                                        
| 8863 | 8863 | $out .= 'return record.text;';  | 
                                                        
| 8864 | 8864 | }  | 
                                                        
| 8865 | - $out .= '}' . "\n";  | 
                                                        |
| 8865 | + $out .= '}'."\n";  | 
                                                        |
| 8866 | 8866 |  				$out .= '$(document).ready(function () { | 
                                                        
| 8867 | -							$(\'#' . $htmlname . '\').' . $tmpplugin . '({'; | 
                                                        |
| 8867 | +							$(\'#' . $htmlname.'\').'.$tmpplugin.'({'; | 
                                                        |
| 8868 | 8868 |  				if ($placeholder) { | 
                                                        
| 8869 | 8869 | $out .= '  | 
                                                        
| 8870 | 8870 |  								placeholder: { | 
                                                        
| 8871 | 8871 | id: \'-1\',  | 
                                                        
| 8872 | - text: \'' . dol_escape_js($placeholder) . '\'  | 
                                                        |
| 8872 | + text: \'' . dol_escape_js($placeholder).'\'  | 
                                                        |
| 8873 | 8873 | },';  | 
                                                        
| 8874 | 8874 | }  | 
                                                        
| 8875 | 8875 | $out .= ' dir: \'ltr\',  | 
                                                        
| 8876 | 8876 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */  | 
                                                        
| 8877 | - dropdownCssClass: \'' . $morecss . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect) */  | 
                                                        |
| 8877 | + dropdownCssClass: \'' . $morecss.'\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect) */  | 
                                                        |
| 8878 | 8878 | // Specify format function for dropdown item  | 
                                                        
| 8879 | 8879 | formatResult: formatResult,  | 
                                                        
| 8880 | 8880 | templateResult: formatResult, /* For 4.0 */  | 
                                                        
@@ -8886,21 +8886,21 @@ discard block  | 
                                                    ||
| 8886 | 8886 | |
| 8887 | 8887 | /* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set  | 
                                                        
| 8888 | 8888 | the size only if component is not hidden by default on load */  | 
                                                        
| 8889 | - $(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');  | 
                                                        |
| 8889 | + $(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\');  | 
                                                        |
| 8890 | 8890 | });' . "\n";  | 
                                                        
| 8891 | 8891 |  			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { | 
                                                        
| 8892 | 8892 | // Add other js lib  | 
                                                        
| 8893 | 8893 | // TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin  | 
                                                        
| 8894 | 8894 | // ...  | 
                                                        
| 8895 | - $out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';  | 
                                                        |
| 8895 | + $out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');';  | 
                                                        |
| 8896 | 8896 |  				$out .= '$(document).ready(function () { | 
                                                        
| 8897 | -							$(\'#' . $htmlname . '\').multiSelect({ | 
                                                        |
| 8897 | +							$(\'#' . $htmlname.'\').multiSelect({ | 
                                                        |
| 8898 | 8898 | containerHTML: \'<div class="multi-select-container">\',  | 
                                                        
| 8899 | 8899 | menuHTML: \'<div class="multi-select-menu">\',  | 
                                                        
| 8900 | - buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',  | 
                                                        |
| 8900 | + buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',  | 
                                                        |
| 8901 | 8901 | menuItemHTML: \'<label class="multi-select-menuitem">\',  | 
                                                        
| 8902 | 8902 | activeClass: \'multi-select-container--open\',  | 
                                                        
| 8903 | - noneText: \'' . $placeholder . '\'  | 
                                                        |
| 8903 | + noneText: \'' . $placeholder.'\'  | 
                                                        |
| 8904 | 8904 | });  | 
                                                        
| 8905 | 8905 | })';  | 
                                                        
| 8906 | 8906 | }  | 
                                                        
@@ -8932,7 +8932,7 @@ discard block  | 
                                                    ||
| 8932 | 8932 | return '';  | 
                                                        
| 8933 | 8933 | }  | 
                                                        
| 8934 | 8934 | |
| 8935 | - $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show  | 
                                                        |
| 8935 | + $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show  | 
                                                        |
| 8936 | 8936 | |
| 8937 | 8937 |  		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user | 
                                                        
| 8938 | 8938 |  			$tmparray = explode(',', $user->conf->$tmpvar); | 
                                                        
@@ -8975,19 +8975,19 @@ discard block  | 
                                                    ||
| 8975 | 8975 | }  | 
                                                        
| 8976 | 8976 | |
| 8977 | 8977 | // Note: $val['checked'] <> 0 means we must show the field into the combo list  | 
                                                        
| 8978 | - $listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>';  | 
                                                        |
| 8979 | - $listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');  | 
                                                        |
| 8978 | + $listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';  | 
                                                        |
| 8979 | + $listcheckedstring .= (empty($val['checked']) ? '' : $key.',');  | 
                                                        |
| 8980 | 8980 | }  | 
                                                        
| 8981 | 8981 | }  | 
                                                        
| 8982 | 8982 | |
| 8983 | - $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->  | 
                                                        |
| 8983 | + $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->  | 
                                                        |
| 8984 | 8984 | |
| 8985 | 8985 | <dl class="dropdown">  | 
                                                        
| 8986 | 8986 | <dt>  | 
                                                        
| 8987 | - <a href="#' . $htmlname . '">  | 
                                                        |
| 8988 | -              ' . img_picto('', 'list') . ' | 
                                                        |
| 8987 | + <a href="#' . $htmlname.'">  | 
                                                        |
| 8988 | +              ' . img_picto('', 'list').' | 
                                                        |
| 8989 | 8989 | </a>  | 
                                                        
| 8990 | - <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">  | 
                                                        |
| 8990 | + <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">  | 
                                                        |
| 8991 | 8991 | </dt>  | 
                                                        
| 8992 | 8992 | <dd class="dropdowndd">  | 
                                                        
| 8993 | 8993 | <div class="multiselectcheckbox'.$htmlname.'">  | 
                                                        
@@ -8999,19 +8999,19 @@ discard block  | 
                                                    ||
| 8999 | 8999 | </dd>  | 
                                                        
| 9000 | 9000 | </dl>  | 
                                                        
| 9001 | 9001 | |
| 9002 | - <script nonce="' . getNonce() . '" type="text/javascript">  | 
                                                        |
| 9002 | + <script nonce="' . getNonce().'" type="text/javascript">  | 
                                                        |
| 9003 | 9003 |            jQuery(document).ready(function () { | 
                                                        
| 9004 | -              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { | 
                                                        |
| 9004 | +              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { | 
                                                        |
| 9005 | 9005 |                    console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); | 
                                                        
| 9006 | 9006 | |
| 9007 | 9007 |                    $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST | 
                                                        
| 9008 | 9008 | |
| 9009 | 9009 | var title = $(this).val() + ",";  | 
                                                        
| 9010 | 9010 |                    if ($(this).is(\':checked\')) { | 
                                                        
| 9011 | - $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());  | 
                                                        |
| 9011 | + $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());  | 
                                                        |
| 9012 | 9012 | }  | 
                                                        
| 9013 | 9013 |                    else { | 
                                                        
| 9014 | - $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )  | 
                                                        |
| 9014 | + $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )  | 
                                                        |
| 9015 | 9015 | }  | 
                                                        
| 9016 | 9016 | // Now, we submit page  | 
                                                        
| 9017 | 9017 | //$(this).parents(\'form:first\').submit();  | 
                                                        
@@ -9042,7 +9042,7 @@ discard block  | 
                                                    ||
| 9042 | 9042 | */  | 
                                                        
| 9043 | 9043 | public function showCategories($id, $type, $rendermode = 0, $nolink = 0)  | 
                                                        
| 9044 | 9044 |  	{ | 
                                                        
| 9045 | - include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';  | 
                                                        |
| 9045 | + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';  | 
                                                        |
| 9046 | 9046 | |
| 9047 | 9047 | $cat = new Categorie($this->db);  | 
                                                        
| 9048 | 9048 | $categories = $cat->containing($id, $type);  | 
                                                        
@@ -9052,10 +9052,10 @@ discard block  | 
                                                    ||
| 9052 | 9052 |  			foreach ($categories as $c) { | 
                                                        
| 9053 | 9053 |  				$ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text | 
                                                        
| 9054 | 9054 |  				foreach ($ways as $way) { | 
                                                        
| 9055 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';  | 
                                                        |
| 9055 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';  | 
                                                        |
| 9056 | 9056 | }  | 
                                                        
| 9057 | 9057 | }  | 
                                                        
| 9058 | -			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; | 
                                                        |
| 9058 | +			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; | 
                                                        |
| 9059 | 9059 | }  | 
                                                        
| 9060 | 9060 | |
| 9061 | 9061 |  		if ($rendermode == 0) { | 
                                                        
@@ -9103,15 +9103,15 @@ discard block  | 
                                                    ||
| 9103 | 9103 | |
| 9104 | 9104 | |
| 9105 | 9105 | print '<div class="div-table-responsive-no-min">';  | 
                                                        
| 9106 | - print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '" data-elementid="' . $object->id . '" >';  | 
                                                        |
| 9106 | + print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >';  | 
                                                        |
| 9107 | 9107 | |
| 9108 | 9108 | print '<tr class="liste_titre">';  | 
                                                        
| 9109 | -			print '<td>' . $langs->trans("Type") . '</td>'; | 
                                                        |
| 9110 | -			print '<td>' . $langs->trans("Ref") . '</td>'; | 
                                                        |
| 9109 | +			print '<td>'.$langs->trans("Type").'</td>'; | 
                                                        |
| 9110 | +			print '<td>'.$langs->trans("Ref").'</td>'; | 
                                                        |
| 9111 | 9111 | print '<td class="center"></td>';  | 
                                                        
| 9112 | -			print '<td class="center">' . $langs->trans("Date") . '</td>'; | 
                                                        |
| 9113 | -			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; | 
                                                        |
| 9114 | -			print '<td class="right">' . $langs->trans("Status") . '</td>'; | 
                                                        |
| 9112 | +			print '<td class="center">'.$langs->trans("Date").'</td>'; | 
                                                        |
| 9113 | +			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; | 
                                                        |
| 9114 | +			print '<td class="right">'.$langs->trans("Status").'</td>'; | 
                                                        |
| 9115 | 9115 | print '<td></td>';  | 
                                                        
| 9116 | 9116 | print '</tr>';  | 
                                                        
| 9117 | 9117 | |
@@ -9130,13 +9130,13 @@ discard block  | 
                                                    ||
| 9130 | 9130 |  				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { | 
                                                        
| 9131 | 9131 | $element = $regs[1];  | 
                                                        
| 9132 | 9132 | $subelement = $regs[2];  | 
                                                        
| 9133 | - $tplpath = $element . '/' . $subelement;  | 
                                                        |
| 9133 | + $tplpath = $element.'/'.$subelement;  | 
                                                        |
| 9134 | 9134 | }  | 
                                                        
| 9135 | 9135 | $tplname = 'linkedobjectblock';  | 
                                                        
| 9136 | 9136 | |
| 9137 | 9137 | // To work with non standard path  | 
                                                        
| 9138 | 9138 |  				if ($objecttype == 'facture') { | 
                                                        
| 9139 | - $tplpath = 'compta/' . $element;  | 
                                                        |
| 9139 | + $tplpath = 'compta/'.$element;  | 
                                                        |
| 9140 | 9140 |  					if (!isModEnabled('facture')) { | 
                                                        
| 9141 | 9141 | continue; // Do not show if module disabled  | 
                                                        
| 9142 | 9142 | }  | 
                                                        
@@ -9147,7 +9147,7 @@ discard block  | 
                                                    ||
| 9147 | 9147 | continue; // Do not show if module disabled  | 
                                                        
| 9148 | 9148 | }  | 
                                                        
| 9149 | 9149 |  				} elseif ($objecttype == 'propal') { | 
                                                        
| 9150 | - $tplpath = 'comm/' . $element;  | 
                                                        |
| 9150 | + $tplpath = 'comm/'.$element;  | 
                                                        |
| 9151 | 9151 |  					if (!isModEnabled('propal')) { | 
                                                        
| 9152 | 9152 | continue; // Do not show if module disabled  | 
                                                        
| 9153 | 9153 | }  | 
                                                        
@@ -9198,14 +9198,14 @@ discard block  | 
                                                    ||
| 9198 | 9198 | $linkedObjectBlock = $objects;  | 
                                                        
| 9199 | 9199 | |
| 9200 | 9200 | // Output template part (modules that overwrite templates must declare this into descriptor)  | 
                                                        
| 9201 | -				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); | 
                                                        |
| 9201 | +				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); | 
                                                        |
| 9202 | 9202 |  				foreach ($dirtpls as $reldir) { | 
                                                        
| 9203 | 9203 |  					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after | 
                                                        
| 9204 | 9204 | global $noMoreLinkedObjectBlockAfter;  | 
                                                        
| 9205 | 9205 | $noMoreLinkedObjectBlockAfter = 1;  | 
                                                        
| 9206 | 9206 | }  | 
                                                        
| 9207 | 9207 | |
| 9208 | - $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');  | 
                                                        |
| 9208 | + $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');  | 
                                                        |
| 9209 | 9209 |  					if ($res) { | 
                                                        
| 9210 | 9210 | $nboftypesoutput++;  | 
                                                        
| 9211 | 9211 | break;  | 
                                                        
@@ -9214,7 +9214,7 @@ discard block  | 
                                                    ||
| 9214 | 9214 | }  | 
                                                        
| 9215 | 9215 | |
| 9216 | 9216 |  			if (!$nboftypesoutput) { | 
                                                        
| 9217 | -				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; | 
                                                        |
| 9217 | +				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; | 
                                                        |
| 9218 | 9218 | }  | 
                                                        
| 9219 | 9219 | |
| 9220 | 9220 | print '</table>';  | 
                                                        
@@ -9254,14 +9254,14 @@ discard block  | 
                                                    ||
| 9254 | 9254 |  		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { | 
                                                        
| 9255 | 9255 | $listofidcompanytoscan = $object->thirdparty->id;  | 
                                                        
| 9256 | 9256 |  			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { | 
                                                        
| 9257 | - $listofidcompanytoscan .= ',' . $object->thirdparty->parent;  | 
                                                        |
| 9257 | + $listofidcompanytoscan .= ','.$object->thirdparty->parent;  | 
                                                        |
| 9258 | 9258 | }  | 
                                                        
| 9259 | 9259 |  			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { | 
                                                        
| 9260 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 9260 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 9261 | 9261 | $tmpproject = new Project($this->db);  | 
                                                        
| 9262 | 9262 | $tmpproject->fetch($object->fk_project);  | 
                                                        
| 9263 | 9263 |  				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { | 
                                                        
| 9264 | - $listofidcompanytoscan .= ',' . $tmpproject->socid;  | 
                                                        |
| 9264 | + $listofidcompanytoscan .= ','.$tmpproject->socid;  | 
                                                        |
| 9265 | 9265 | }  | 
                                                        
| 9266 | 9266 | unset($tmpproject);  | 
                                                        
| 9267 | 9267 | }  | 
                                                        
@@ -9271,63 +9271,63 @@ discard block  | 
                                                    ||
| 9271 | 9271 |  					'enabled' => isModEnabled('propal'), | 
                                                        
| 9272 | 9272 | 'perms' => 1,  | 
                                                        
| 9273 | 9273 | 'label' => 'LinkToProposal',  | 
                                                        
| 9274 | -					'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') . ')'), | 
                                                        |
| 9274 | +					'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').')'), | 
                                                        |
| 9275 | 9275 | 'shipping' => array(  | 
                                                        
| 9276 | 9276 |  					'enabled' => isModEnabled('expedition'), | 
                                                        
| 9277 | 9277 | 'perms' => 1,  | 
                                                        
| 9278 | 9278 | 'label' => 'LinkToExpedition',  | 
                                                        
| 9279 | -					'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') . ')'), | 
                                                        |
| 9279 | +					'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').')'), | 
                                                        |
| 9280 | 9280 | 'order' => array(  | 
                                                        
| 9281 | 9281 |  					'enabled' => isModEnabled('commande'), | 
                                                        
| 9282 | 9282 | 'perms' => 1,  | 
                                                        
| 9283 | 9283 | 'label' => 'LinkToOrder',  | 
                                                        
| 9284 | -					'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') . ')'), | 
                                                        |
| 9284 | +					'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').')'), | 
                                                        |
| 9285 | 9285 | 'invoice' => array(  | 
                                                        
| 9286 | 9286 |  					'enabled' => isModEnabled('facture'), | 
                                                        
| 9287 | 9287 | 'perms' => 1,  | 
                                                        
| 9288 | 9288 | 'label' => 'LinkToInvoice',  | 
                                                        
| 9289 | -					'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') . ')'), | 
                                                        |
| 9289 | +					'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').')'), | 
                                                        |
| 9290 | 9290 | 'invoice_template' => array(  | 
                                                        
| 9291 | 9291 |  					'enabled' => isModEnabled('facture'), | 
                                                        
| 9292 | 9292 | 'perms' => 1,  | 
                                                        
| 9293 | 9293 | 'label' => 'LinkToTemplateInvoice',  | 
                                                        
| 9294 | -					'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') . ')'), | 
                                                        |
| 9294 | +					'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').')'), | 
                                                        |
| 9295 | 9295 | 'contrat' => array(  | 
                                                        
| 9296 | 9296 |  					'enabled' => isModEnabled('contrat'), | 
                                                        
| 9297 | 9297 | 'perms' => 1,  | 
                                                        
| 9298 | 9298 | 'label' => 'LinkToContract',  | 
                                                        
| 9299 | 9299 | '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  | 
                                                        
| 9300 | -							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' | 
                                                        |
| 9300 | +							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' | 
                                                        |
| 9301 | 9301 | ),  | 
                                                        
| 9302 | 9302 | 'fichinter' => array(  | 
                                                        
| 9303 | 9303 |  					'enabled' => isModEnabled('ficheinter'), | 
                                                        
| 9304 | 9304 | 'perms' => 1,  | 
                                                        
| 9305 | 9305 | 'label' => 'LinkToIntervention',  | 
                                                        
| 9306 | -					'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') . ')'), | 
                                                        |
| 9306 | +					'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').')'), | 
                                                        |
| 9307 | 9307 | 'supplier_proposal' => array(  | 
                                                        
| 9308 | 9308 |  					'enabled' => isModEnabled('supplier_proposal'), | 
                                                        
| 9309 | 9309 | 'perms' => 1,  | 
                                                        
| 9310 | 9310 | 'label' => 'LinkToSupplierProposal',  | 
                                                        
| 9311 | -					'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') . ')'), | 
                                                        |
| 9311 | +					'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').')'), | 
                                                        |
| 9312 | 9312 | 'order_supplier' => array(  | 
                                                        
| 9313 | 9313 |  					'enabled' => isModEnabled("supplier_order"), | 
                                                        
| 9314 | 9314 | 'perms' => 1,  | 
                                                        
| 9315 | 9315 | 'label' => 'LinkToSupplierOrder',  | 
                                                        
| 9316 | -					'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') . ')'), | 
                                                        |
| 9316 | +					'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').')'), | 
                                                        |
| 9317 | 9317 | 'invoice_supplier' => array(  | 
                                                        
| 9318 | 9318 |  					'enabled' => isModEnabled("supplier_invoice"), | 
                                                        
| 9319 | 9319 | 'perms' => 1, 'label' => 'LinkToSupplierInvoice',  | 
                                                        
| 9320 | -					'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') . ')'), | 
                                                        |
| 9320 | +					'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').')'), | 
                                                        |
| 9321 | 9321 | 'ticket' => array(  | 
                                                        
| 9322 | 9322 |  					'enabled' => isModEnabled('ticket'), | 
                                                        
| 9323 | 9323 | 'perms' => 1,  | 
                                                        
| 9324 | 9324 | 'label' => 'LinkToTicket',  | 
                                                        
| 9325 | -					'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') . ')'), | 
                                                        |
| 9325 | +					'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').')'), | 
                                                        |
| 9326 | 9326 | 'mo' => array(  | 
                                                        
| 9327 | 9327 |  					'enabled' => isModEnabled('mrp'), | 
                                                        
| 9328 | 9328 | 'perms' => 1,  | 
                                                        
| 9329 | 9329 | 'label' => 'LinkToMo',  | 
                                                        
| 9330 | -					'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') . ')') | 
                                                        |
| 9330 | +					'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').')') | 
                                                        |
| 9331 | 9331 | );  | 
                                                        
| 9332 | 9332 | }  | 
                                                        
| 9333 | 9333 | |
@@ -9362,22 +9362,22 @@ discard block  | 
                                                    ||
| 9362 | 9362 | }  | 
                                                        
| 9363 | 9363 | |
| 9364 | 9364 |  			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { | 
                                                        
| 9365 | - print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';  | 
                                                        |
| 9365 | + print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';  | 
                                                        |
| 9366 | 9366 | |
| 9367 | 9367 |  				if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { | 
                                                        
| 9368 | 9368 | print '<br>'."\n";  | 
                                                        
| 9369 | 9369 | print '<!-- form to add a link from anywhere -->'."\n";  | 
                                                        
| 9370 | - print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';  | 
                                                        |
| 9371 | - print '<input type="hidden" name="id" value="' . $object->id . '">';  | 
                                                        |
| 9370 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';  | 
                                                        |
| 9371 | + print '<input type="hidden" name="id" value="'.$object->id.'">';  | 
                                                        |
| 9372 | 9372 | print '<input type="hidden" name="action" value="addlinkbyref">';  | 
                                                        
| 9373 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 9374 | - print '<input type="hidden" name="addlink" value="' . $key . '">';  | 
                                                        |
| 9373 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 9374 | + print '<input type="hidden" name="addlink" value="'.$key.'">';  | 
                                                        |
| 9375 | 9375 | print '<table class="noborder">';  | 
                                                        
| 9376 | 9376 | print '<tr>';  | 
                                                        
| 9377 | 9377 |  					//print '<td>' . $langs->trans("Ref") . '</td>'; | 
                                                        
| 9378 | -					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; | 
                                                        |
| 9379 | -					print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '"> '; | 
                                                        |
| 9380 | -					print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; | 
                                                        |
| 9378 | +					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; | 
                                                        |
| 9379 | +					print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'"> '; | 
                                                        |
| 9380 | +					print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; | 
                                                        |
| 9381 | 9381 | print '</tr>';  | 
                                                        
| 9382 | 9382 | print '</table>';  | 
                                                        
| 9383 | 9383 | print '</form>';  | 
                                                        
@@ -9392,48 +9392,48 @@ discard block  | 
                                                    ||
| 9392 | 9392 | |
| 9393 | 9393 | print '<br>';  | 
                                                        
| 9394 | 9394 | print '<!-- form to add a link from object to same thirdparty -->'."\n";  | 
                                                        
| 9395 | - print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';  | 
                                                        |
| 9395 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';  | 
                                                        |
| 9396 | 9396 | print '<input type="hidden" name="action" value="addlink">';  | 
                                                        
| 9397 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 9398 | - print '<input type="hidden" name="id" value="' . $object->id . '">';  | 
                                                        |
| 9399 | - print '<input type="hidden" name="addlink" value="' . $key . '">';  | 
                                                        |
| 9397 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 9398 | + print '<input type="hidden" name="id" value="'.$object->id.'">';  | 
                                                        |
| 9399 | + print '<input type="hidden" name="addlink" value="'.$key.'">';  | 
                                                        |
| 9400 | 9400 | print '<table class="noborder">';  | 
                                                        
| 9401 | 9401 | print '<tr class="liste_titre">';  | 
                                                        
| 9402 | 9402 | print '<td class="nowrap"></td>';  | 
                                                        
| 9403 | -					print '<td class="center">' . $langs->trans("Ref") . '</td>'; | 
                                                        |
| 9404 | -					print '<td class="left">' . $langs->trans("RefCustomer") . '</td>'; | 
                                                        |
| 9405 | -					print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; | 
                                                        |
| 9406 | -					print '<td class="left">' . $langs->trans("Company") . '</td>'; | 
                                                        |
| 9403 | +					print '<td class="center">'.$langs->trans("Ref").'</td>'; | 
                                                        |
| 9404 | +					print '<td class="left">'.$langs->trans("RefCustomer").'</td>'; | 
                                                        |
| 9405 | +					print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; | 
                                                        |
| 9406 | +					print '<td class="left">'.$langs->trans("Company").'</td>'; | 
                                                        |
| 9407 | 9407 | print '</tr>';  | 
                                                        
| 9408 | 9408 |  					while ($i < $num) { | 
                                                        
| 9409 | 9409 | $objp = $this->db->fetch_object($resqllist);  | 
                                                        
| 9410 | 9410 | |
| 9411 | 9411 | print '<tr class="oddeven">';  | 
                                                        
| 9412 | 9412 | print '<td class="left">';  | 
                                                        
| 9413 | - print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">';  | 
                                                        |
| 9413 | + print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';  | 
                                                        |
| 9414 | 9414 | print '</td>';  | 
                                                        
| 9415 | - print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>';  | 
                                                        |
| 9416 | - print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>';  | 
                                                        |
| 9415 | + print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';  | 
                                                        |
| 9416 | + print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>';  | 
                                                        |
| 9417 | 9417 | print '<td class="right">';  | 
                                                        
| 9418 | 9418 |  						if ($possiblelink['label'] == 'LinkToContract') { | 
                                                        
| 9419 | 9419 | $form = new Form($this->db);  | 
                                                        
| 9420 | -							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; | 
                                                        |
| 9420 | +							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; | 
                                                        |
| 9421 | 9421 | }  | 
                                                        
| 9422 | - print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>';  | 
                                                        |
| 9422 | + print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';  | 
                                                        |
| 9423 | 9423 | print '</td>';  | 
                                                        
| 9424 | - print '<td>' . $objp->name . '</td>';  | 
                                                        |
| 9424 | + print '<td>'.$objp->name.'</td>';  | 
                                                        |
| 9425 | 9425 | print '</tr>';  | 
                                                        
| 9426 | 9426 | $i++;  | 
                                                        
| 9427 | 9427 | }  | 
                                                        
| 9428 | 9428 | print '</table>';  | 
                                                        
| 9429 | 9429 | print '<div class="center">';  | 
                                                        
| 9430 | 9430 |  					if ($num) { | 
                                                        
| 9431 | -						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">'; | 
                                                        |
| 9431 | +						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">'; | 
                                                        |
| 9432 | 9432 | }  | 
                                                        
| 9433 | 9433 |  					if (empty($conf->use_javascript_ajax)) { | 
                                                        
| 9434 | -						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; | 
                                                        |
| 9434 | +						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; | 
                                                        |
| 9435 | 9435 |  					} else { | 
                                                        
| 9436 | -						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>'; | 
                                                        |
| 9436 | +						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>'; | 
                                                        |
| 9437 | 9437 | }  | 
                                                        
| 9438 | 9438 | print '</form>';  | 
                                                        
| 9439 | 9439 | $this->db->free($resqllist);  | 
                                                        
@@ -9444,10 +9444,10 @@ discard block  | 
                                                    ||
| 9444 | 9444 | |
| 9445 | 9445 | //$linktoelem.=($linktoelem?'   ':'');  | 
                                                        
| 9446 | 9446 |  				if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { | 
                                                        
| 9447 | -					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; | 
                                                        |
| 9447 | +					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; | 
                                                        |
| 9448 | 9448 | // } else $linktoelem.=$langs->trans($possiblelink['label']);  | 
                                                        
| 9449 | 9449 |  				} else { | 
                                                        
| 9450 | - $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';  | 
                                                        |
| 9450 | + $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';  | 
                                                        |
| 9451 | 9451 | }  | 
                                                        
| 9452 | 9452 | }  | 
                                                        
| 9453 | 9453 | }  | 
                                                        
@@ -9457,11 +9457,11 @@ discard block  | 
                                                    ||
| 9457 | 9457 | <dl class="dropdown" id="linktoobjectname">  | 
                                                        
| 9458 | 9458 | ';  | 
                                                        
| 9459 | 9459 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 9460 | -				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; | 
                                                        |
| 9460 | +				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; | 
                                                        |
| 9461 | 9461 | }  | 
                                                        
| 9462 | 9462 | $linktoelem .= '<dd>  | 
                                                        
| 9463 | 9463 | <div class="multiselectlinkto">  | 
                                                        
| 9464 | - <ul class="ulselectedfields">' . $linktoelemlist . '  | 
                                                        |
| 9464 | + <ul class="ulselectedfields">' . $linktoelemlist.'  | 
                                                        |
| 9465 | 9465 | </ul>  | 
                                                        
| 9466 | 9466 | </div>  | 
                                                        
| 9467 | 9467 | </dd>  | 
                                                        
@@ -9472,7 +9472,7 @@ discard block  | 
                                                    ||
| 9472 | 9472 | |
| 9473 | 9473 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 9474 | 9474 | print '<!-- Add js to show linkto box -->  | 
                                                        
| 9475 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 9475 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 9476 | 9476 |  				jQuery(document).ready(function() { | 
                                                        
| 9477 | 9477 |  					jQuery(".linkto").click(function() { | 
                                                        
| 9478 | 9478 |  						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); | 
                                                        
@@ -9513,19 +9513,19 @@ discard block  | 
                                                    ||
| 9513 | 9513 | |
| 9514 | 9514 | $disabled = ($disabled ? ' disabled' : '');  | 
                                                        
| 9515 | 9515 | |
| 9516 | - $resultyesno = '<select class="flat width75' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";  | 
                                                        |
| 9516 | + $resultyesno = '<select class="flat width75'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";  | 
                                                        |
| 9517 | 9517 |  		if ($useempty) { | 
                                                        
| 9518 | - $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n";  | 
                                                        |
| 9518 | + $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n";  | 
                                                        |
| 9519 | 9519 | }  | 
                                                        
| 9520 | 9520 |  		if (("$value" == 'yes') || ($value == 1)) { | 
                                                        
| 9521 | - $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n";  | 
                                                        |
| 9522 | - $resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n";  | 
                                                        |
| 9521 | + $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";  | 
                                                        |
| 9522 | + $resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";  | 
                                                        |
| 9523 | 9523 |  		} else { | 
                                                        
| 9524 | 9524 | $selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');  | 
                                                        
| 9525 | - $resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n";  | 
                                                        |
| 9526 | - $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n";  | 
                                                        |
| 9525 | + $resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";  | 
                                                        |
| 9526 | + $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";  | 
                                                        |
| 9527 | 9527 | }  | 
                                                        
| 9528 | - $resultyesno .= '</select>' . "\n";  | 
                                                        |
| 9528 | + $resultyesno .= '</select>'."\n";  | 
                                                        |
| 9529 | 9529 | |
| 9530 | 9530 |  		if ($addjscombo) { | 
                                                        
| 9531 | 9531 | $resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);  | 
                                                        
@@ -9549,12 +9549,12 @@ discard block  | 
                                                    ||
| 9549 | 9549 |  	{ | 
                                                        
| 9550 | 9550 | // phpcs:enable  | 
                                                        
| 9551 | 9551 | $sql = "SELECT rowid, label";  | 
                                                        
| 9552 | - $sql .= " FROM " . $this->db->prefix() . "export_model";  | 
                                                        |
| 9553 | - $sql .= " WHERE type = '" . $this->db->escape($type) . "'";  | 
                                                        |
| 9552 | + $sql .= " FROM ".$this->db->prefix()."export_model";  | 
                                                        |
| 9553 | + $sql .= " WHERE type = '".$this->db->escape($type)."'";  | 
                                                        |
| 9554 | 9554 | $sql .= " ORDER BY rowid";  | 
                                                        
| 9555 | 9555 | $result = $this->db->query($sql);  | 
                                                        
| 9556 | 9556 |  		if ($result) { | 
                                                        
| 9557 | - print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 9557 | + print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 9558 | 9558 |  			if ($useempty) { | 
                                                        
| 9559 | 9559 | print '<option value="-1"> </option>';  | 
                                                        
| 9560 | 9560 | }  | 
                                                        
@@ -9564,9 +9564,9 @@ discard block  | 
                                                    ||
| 9564 | 9564 |  			while ($i < $num) { | 
                                                        
| 9565 | 9565 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 9566 | 9566 |  				if ($selected == $obj->rowid) { | 
                                                        
| 9567 | - print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        |
| 9567 | + print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        |
| 9568 | 9568 |  				} else { | 
                                                        
| 9569 | - print '<option value="' . $obj->rowid . '">';  | 
                                                        |
| 9569 | + print '<option value="'.$obj->rowid.'">';  | 
                                                        |
| 9570 | 9570 | }  | 
                                                        
| 9571 | 9571 | print $obj->label;  | 
                                                        
| 9572 | 9572 | print '</option>';  | 
                                                        
@@ -9656,8 +9656,8 @@ discard block  | 
                                                    ||
| 9656 | 9656 | $stringforfirstkey .= ' CTL +';  | 
                                                        
| 9657 | 9657 | }  | 
                                                        
| 9658 | 9658 | |
| 9659 | - $previous_ref = $object->ref_previous ? '<a accesskey="p" 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>';  | 
                                                        |
| 9660 | - $next_ref = $object->ref_next ? '<a accesskey="n" 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>';  | 
                                                        |
| 9659 | + $previous_ref = $object->ref_previous ? '<a accesskey="p" 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>';  | 
                                                        |
| 9660 | + $next_ref = $object->ref_next ? '<a accesskey="n" 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>';  | 
                                                        |
| 9661 | 9661 | }  | 
                                                        
| 9662 | 9662 | |
| 9663 | 9663 | //print "xx".$previous_ref."x".$next_ref;  | 
                                                        
@@ -9665,18 +9665,18 @@ discard block  | 
                                                    ||
| 9665 | 9665 | |
| 9666 | 9666 | // Right part of banner  | 
                                                        
| 9667 | 9667 |  		if ($morehtmlright) { | 
                                                        
| 9668 | - $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';  | 
                                                        |
| 9668 | + $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';  | 
                                                        |
| 9669 | 9669 | }  | 
                                                        
| 9670 | 9670 | |
| 9671 | 9671 |  		if ($previous_ref || $next_ref || $morehtml) { | 
                                                        
| 9672 | 9672 | $ret .= '<div class="pagination paginationref"><ul class="right">';  | 
                                                        
| 9673 | 9673 | }  | 
                                                        
| 9674 | 9674 |  		if ($morehtml) { | 
                                                        
| 9675 | - $ret .= '<li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';  | 
                                                        |
| 9675 | + $ret .= '<li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';  | 
                                                        |
| 9676 | 9676 | }  | 
                                                        
| 9677 | 9677 |  		if ($shownav && ($previous_ref || $next_ref)) { | 
                                                        
| 9678 | - $ret .= '<li class="pagination">' . $previous_ref . '</li>';  | 
                                                        |
| 9679 | - $ret .= '<li class="pagination">' . $next_ref . '</li>';  | 
                                                        |
| 9678 | + $ret .= '<li class="pagination">'.$previous_ref.'</li>';  | 
                                                        |
| 9679 | + $ret .= '<li class="pagination">'.$next_ref.'</li>';  | 
                                                        |
| 9680 | 9680 | }  | 
                                                        
| 9681 | 9681 |  		if ($previous_ref || $next_ref || $morehtml) { | 
                                                        
| 9682 | 9682 | $ret .= '</ul></div>';  | 
                                                        
@@ -9691,7 +9691,7 @@ discard block  | 
                                                    ||
| 9691 | 9691 | $morehtmlstatus = $hookmanager->resPrint;  | 
                                                        
| 9692 | 9692 | }  | 
                                                        
| 9693 | 9693 |  		if ($morehtmlstatus) { | 
                                                        
| 9694 | - $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';  | 
                                                        |
| 9694 | + $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';  | 
                                                        |
| 9695 | 9695 | }  | 
                                                        
| 9696 | 9696 | |
| 9697 | 9697 | $parameters = array();  | 
                                                        
@@ -9705,14 +9705,14 @@ discard block  | 
                                                    ||
| 9705 | 9705 | // Left part of banner  | 
                                                        
| 9706 | 9706 |  		if ($morehtmlleft) { | 
                                                        
| 9707 | 9707 |  			if ($conf->browser->layout == 'phone') { | 
                                                        
| 9708 | - $ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>';  | 
                                                        |
| 9708 | + $ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>';  | 
                                                        |
| 9709 | 9709 |  			} else { | 
                                                        
| 9710 | - $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>';  | 
                                                        |
| 9710 | + $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';  | 
                                                        |
| 9711 | 9711 | }  | 
                                                        
| 9712 | 9712 | }  | 
                                                        
| 9713 | 9713 | |
| 9714 | 9714 | //if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';  | 
                                                        
| 9715 | - $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';  | 
                                                        |
| 9715 | + $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';  | 
                                                        |
| 9716 | 9716 | |
| 9717 | 9717 | // For thirdparty, contact, user, member, the ref is the id, so we show something else  | 
                                                        
| 9718 | 9718 |  		if ($object->element == 'societe') { | 
                                                        
@@ -9726,7 +9726,7 @@ discard block  | 
                                                    ||
| 9726 | 9726 | |
| 9727 | 9727 |  			if (is_array($arrayoflangcode) && count($arrayoflangcode)) { | 
                                                        
| 9728 | 9728 |  				if (!is_object($extralanguages)) { | 
                                                        
| 9729 | - include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';  | 
                                                        |
| 9729 | + include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';  | 
                                                        |
| 9730 | 9730 | $extralanguages = new ExtraLanguages($this->db);  | 
                                                        
| 9731 | 9731 | }  | 
                                                        
| 9732 | 9732 |  				$extralanguages->fetch_name_extralanguages('societe'); | 
                                                        
@@ -9741,27 +9741,27 @@ discard block  | 
                                                    ||
| 9741 | 9741 |  						if ($object->array_languages['name'][$extralangcode]) { | 
                                                        
| 9742 | 9742 | $htmltext .= $object->array_languages['name'][$extralangcode];  | 
                                                        
| 9743 | 9743 |  						} else { | 
                                                        
| 9744 | -							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; | 
                                                        |
| 9744 | +							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; | 
                                                        |
| 9745 | 9745 | }  | 
                                                        
| 9746 | 9746 | }  | 
                                                        
| 9747 | - $ret .= '<!-- Show translations of name -->' . "\n";  | 
                                                        |
| 9747 | + $ret .= '<!-- Show translations of name -->'."\n";  | 
                                                        |
| 9748 | 9748 |  					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); | 
                                                        
| 9749 | 9749 | }  | 
                                                        
| 9750 | 9750 | }  | 
                                                        
| 9751 | 9751 |  		} elseif ($object->element == 'member') { | 
                                                        
| 9752 | - $ret .= $object->ref . '<br>';  | 
                                                        |
| 9752 | + $ret .= $object->ref.'<br>';  | 
                                                        |
| 9753 | 9753 | $fullname = $object->getFullName($langs);  | 
                                                        
| 9754 | 9754 |  			if ($object->morphy == 'mor' && $object->societe) { | 
                                                        
| 9755 | -				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); | 
                                                        |
| 9755 | +				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); | 
                                                        |
| 9756 | 9756 |  			} else { | 
                                                        
| 9757 | -				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); | 
                                                        |
| 9757 | +				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); | 
                                                        |
| 9758 | 9758 | }  | 
                                                        
| 9759 | 9759 |  		} elseif (in_array($object->element, array('contact', 'user'))) { | 
                                                        
| 9760 | - $ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt;  | 
                                                        |
| 9760 | + $ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt;  | 
                                                        |
| 9761 | 9761 |  		} elseif ($object->element == 'usergroup') { | 
                                                        
| 9762 | 9762 | $ret .= dol_htmlentities($object->name);  | 
                                                        
| 9763 | 9763 |  		} elseif (in_array($object->element, array('action', 'agenda'))) { | 
                                                        
| 9764 | - $ret .= $object->ref . '<br>' . $object->label;  | 
                                                        |
| 9764 | + $ret .= $object->ref.'<br>'.$object->label;  | 
                                                        |
| 9765 | 9765 |  		} elseif (in_array($object->element, array('adherent_type'))) { | 
                                                        
| 9766 | 9766 | $ret .= $object->label;  | 
                                                        
| 9767 | 9767 |  		} elseif ($object->element == 'ecm_directories') { | 
                                                        
@@ -9813,9 +9813,9 @@ discard block  | 
                                                    ||
| 9813 | 9813 | }  | 
                                                        
| 9814 | 9814 | |
| 9815 | 9815 | // Barcode image  | 
                                                        
| 9816 | - $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);  | 
                                                        |
| 9817 | - $out = '<!-- url barcode = ' . $url . ' -->';  | 
                                                        |
| 9818 | - $out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>';  | 
                                                        |
| 9816 | + $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);  | 
                                                        |
| 9817 | + $out = '<!-- url barcode = '.$url.' -->';  | 
                                                        |
| 9818 | + $out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>';  | 
                                                        |
| 9819 | 9819 | |
| 9820 | 9820 | return $out;  | 
                                                        
| 9821 | 9821 | }  | 
                                                        
@@ -9855,28 +9855,28 @@ discard block  | 
                                                    ||
| 9855 | 9855 |  			if (!empty($object->logo)) { | 
                                                        
| 9856 | 9856 |  				if (dolIsAllowedForPreview($object->logo)) { | 
                                                        
| 9857 | 9857 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 9858 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs  | 
                                                        |
| 9858 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs  | 
                                                        |
| 9859 | 9859 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 9860 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');  | 
                                                        |
| 9860 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small');  | 
                                                        |
| 9861 | 9861 |  					} else { | 
                                                        
| 9862 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;  | 
                                                        |
| 9862 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;  | 
                                                        |
| 9863 | 9863 | }  | 
                                                        
| 9864 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;  | 
                                                        |
| 9864 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;  | 
                                                        |
| 9865 | 9865 | }  | 
                                                        
| 9866 | 9866 | }  | 
                                                        
| 9867 | 9867 | $email = $object->email;  | 
                                                        
| 9868 | 9868 |  		} elseif ($modulepart == 'contact') { | 
                                                        
| 9869 | - $dir = $conf->societe->multidir_output[$entity] . '/contact';  | 
                                                        |
| 9869 | + $dir = $conf->societe->multidir_output[$entity].'/contact';  | 
                                                        |
| 9870 | 9870 |  			if (!empty($object->photo)) { | 
                                                        
| 9871 | 9871 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
| 9872 | 9872 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 9873 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9873 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9874 | 9874 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 9875 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9875 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9876 | 9876 |  					} else { | 
                                                        
| 9877 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;  | 
                                                        |
| 9877 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;  | 
                                                        |
| 9878 | 9878 | }  | 
                                                        
| 9879 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;  | 
                                                        |
| 9879 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;  | 
                                                        |
| 9880 | 9880 | }  | 
                                                        
| 9881 | 9881 | }  | 
                                                        
| 9882 | 9882 | $email = $object->email;  | 
                                                        
@@ -9886,17 +9886,17 @@ discard block  | 
                                                    ||
| 9886 | 9886 |  			if (!empty($object->photo)) { | 
                                                        
| 9887 | 9887 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
| 9888 | 9888 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 9889 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9889 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9890 | 9890 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 9891 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9891 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9892 | 9892 |  					} else { | 
                                                        
| 9893 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;  | 
                                                        |
| 9893 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;  | 
                                                        |
| 9894 | 9894 | }  | 
                                                        
| 9895 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;  | 
                                                        |
| 9895 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;  | 
                                                        |
| 9896 | 9896 | }  | 
                                                        
| 9897 | 9897 | }  | 
                                                        
| 9898 | 9898 |  			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { | 
                                                        
| 9899 | - $altfile = $object->id . ".jpg"; // For backward compatibility  | 
                                                        |
| 9899 | + $altfile = $object->id.".jpg"; // For backward compatibility  | 
                                                        |
| 9900 | 9900 | }  | 
                                                        
| 9901 | 9901 | $email = $object->email;  | 
                                                        
| 9902 | 9902 | $capture = 'user';  | 
                                                        
@@ -9905,17 +9905,17 @@ discard block  | 
                                                    ||
| 9905 | 9905 |  			if (!empty($object->photo)) { | 
                                                        
| 9906 | 9906 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
| 9907 | 9907 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 9908 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9908 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9909 | 9909 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 9910 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9910 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9911 | 9911 |  					} else { | 
                                                        
| 9912 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;  | 
                                                        |
| 9912 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;  | 
                                                        |
| 9913 | 9913 | }  | 
                                                        
| 9914 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;  | 
                                                        |
| 9914 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;  | 
                                                        |
| 9915 | 9915 | }  | 
                                                        
| 9916 | 9916 | }  | 
                                                        
| 9917 | 9917 |  			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { | 
                                                        
| 9918 | - $altfile = $object->id . ".jpg"; // For backward compatibility  | 
                                                        |
| 9918 | + $altfile = $object->id.".jpg"; // For backward compatibility  | 
                                                        |
| 9919 | 9919 | }  | 
                                                        
| 9920 | 9920 | $email = $object->email;  | 
                                                        
| 9921 | 9921 | $capture = 'user';  | 
                                                        
@@ -9925,17 +9925,17 @@ discard block  | 
                                                    ||
| 9925 | 9925 |  			if (!empty($object->photo)) { | 
                                                        
| 9926 | 9926 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
| 9927 | 9927 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 9928 | - $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9928 | + $file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9929 | 9929 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 9930 | - $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9930 | + $file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9931 | 9931 |  					} else { | 
                                                        
| 9932 | - $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo;  | 
                                                        |
| 9932 | + $file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo;  | 
                                                        |
| 9933 | 9933 | }  | 
                                                        
| 9934 | - $originalfile = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo;  | 
                                                        |
| 9934 | + $originalfile = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo;  | 
                                                        |
| 9935 | 9935 | }  | 
                                                        
| 9936 | 9936 | }  | 
                                                        
| 9937 | 9937 |  			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { | 
                                                        
| 9938 | - $altfile = $object->id . ".jpg"; // For backward compatibility  | 
                                                        |
| 9938 | + $altfile = $object->id.".jpg"; // For backward compatibility  | 
                                                        |
| 9939 | 9939 | }  | 
                                                        
| 9940 | 9940 | $email = $object->email;  | 
                                                        
| 9941 | 9941 | }  | 
                                                        
@@ -9945,35 +9945,35 @@ discard block  | 
                                                    ||
| 9945 | 9945 | }  | 
                                                        
| 9946 | 9946 | |
| 9947 | 9947 |  		if ($dir) { | 
                                                        
| 9948 | -			if ($file && file_exists($dir . "/" . $file)) { | 
                                                        |
| 9948 | +			if ($file && file_exists($dir."/".$file)) { | 
                                                        |
| 9949 | 9949 |  				if ($addlinktofullsize) { | 
                                                        
| 9950 | - $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);  | 
                                                        |
| 9950 | + $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);  | 
                                                        |
| 9951 | 9951 |  					if ($urladvanced) { | 
                                                        
| 9952 | - $ret .= '<a href="' . $urladvanced . '">';  | 
                                                        |
| 9952 | + $ret .= '<a href="'.$urladvanced.'">';  | 
                                                        |
| 9953 | 9953 |  					} else { | 
                                                        
| 9954 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';  | 
                                                        |
| 9954 | + $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';  | 
                                                        |
| 9955 | 9955 | }  | 
                                                        
| 9956 | 9956 | }  | 
                                                        
| 9957 | -				$ret .= '<img alt="Photo" 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 . '">'; | 
                                                        |
| 9957 | +				$ret .= '<img alt="Photo" 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.'">'; | 
                                                        |
| 9958 | 9958 |  				if ($addlinktofullsize) { | 
                                                        
| 9959 | 9959 | $ret .= '</a>';  | 
                                                        
| 9960 | 9960 | }  | 
                                                        
| 9961 | -			} elseif ($altfile && file_exists($dir . "/" . $altfile)) { | 
                                                        |
| 9961 | +			} elseif ($altfile && file_exists($dir."/".$altfile)) { | 
                                                        |
| 9962 | 9962 |  				if ($addlinktofullsize) { | 
                                                        
| 9963 | - $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);  | 
                                                        |
| 9963 | + $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);  | 
                                                        |
| 9964 | 9964 |  					if ($urladvanced) { | 
                                                        
| 9965 | - $ret .= '<a href="' . $urladvanced . '">';  | 
                                                        |
| 9965 | + $ret .= '<a href="'.$urladvanced.'">';  | 
                                                        |
| 9966 | 9966 |  					} else { | 
                                                        
| 9967 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';  | 
                                                        |
| 9967 | + $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';  | 
                                                        |
| 9968 | 9968 | }  | 
                                                        
| 9969 | 9969 | }  | 
                                                        
| 9970 | -				$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 . '">'; | 
                                                        |
| 9970 | +				$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.'">'; | 
                                                        |
| 9971 | 9971 |  				if ($addlinktofullsize) { | 
                                                        
| 9972 | 9972 | $ret .= '</a>';  | 
                                                        
| 9973 | 9973 | }  | 
                                                        
| 9974 | 9974 |  			} else { | 
                                                        
| 9975 | 9975 | $nophoto = '/public/theme/common/nophoto.png';  | 
                                                        
| 9976 | - $defaultimg = 'identicon'; // For gravatar  | 
                                                        |
| 9976 | + $defaultimg = 'identicon'; // For gravatar  | 
                                                        |
| 9977 | 9977 |  				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found | 
                                                        
| 9978 | 9978 |  					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor')) !== false) { | 
                                                        
| 9979 | 9979 | $nophoto = 'company';  | 
                                                        
@@ -9991,13 +9991,13 @@ discard block  | 
                                                    ||
| 9991 | 9991 |  				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { | 
                                                        
| 9992 | 9992 | // see https://gravatar.com/site/implement/images/php/  | 
                                                        
| 9993 | 9993 | $ret .= '<!-- Put link to gravatar -->';  | 
                                                        
| 9994 | - $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  | 
                                                        |
| 9994 | + $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  | 
                                                        |
| 9995 | 9995 |  				} else { | 
                                                        
| 9996 | 9996 |  					if ($nophoto == 'company') { | 
                                                        
| 9997 | -						$ret .= '<div class="divforspanimg photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; | 
                                                        |
| 9997 | +						$ret .= '<div class="divforspanimg photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; | 
                                                        |
| 9998 | 9998 | $ret .= '<div class="difforspanimgright"></div>';  | 
                                                        
| 9999 | 9999 |  					} else { | 
                                                        
| 10000 | - $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';  | 
                                                        |
| 10000 | + $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';  | 
                                                        |
| 10001 | 10001 | }  | 
                                                        
| 10002 | 10002 | }  | 
                                                        
| 10003 | 10003 | }  | 
                                                        
@@ -10008,15 +10008,15 @@ discard block  | 
                                                    ||
| 10008 | 10008 | }  | 
                                                        
| 10009 | 10009 | $ret .= '<table class="nobordernopadding centpercent">';  | 
                                                        
| 10010 | 10010 |  				if ($object->photo) { | 
                                                        
| 10011 | -					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; | 
                                                        |
| 10011 | +					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; | 
                                                        |
| 10012 | 10012 | }  | 
                                                        
| 10013 | 10013 | $ret .= '<tr><td class="tdoverflow">';  | 
                                                        
| 10014 | 10014 | $maxfilesizearray = getMaxFileSizeArray();  | 
                                                        
| 10015 | 10015 | $maxmin = $maxfilesizearray['maxmin'];  | 
                                                        
| 10016 | 10016 |  				if ($maxmin > 0) { | 
                                                        
| 10017 | - $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 10017 | + $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 10018 | 10018 | }  | 
                                                        
| 10019 | - $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>';  | 
                                                        |
| 10019 | + $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';  | 
                                                        |
| 10020 | 10020 | $ret .= '</td></tr>';  | 
                                                        
| 10021 | 10021 | $ret .= '</table>';  | 
                                                        
| 10022 | 10022 | }  | 
                                                        
@@ -10070,38 +10070,38 @@ discard block  | 
                                                    ||
| 10070 | 10070 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
| 10071 | 10071 | $sql .= ", e.label";  | 
                                                        
| 10072 | 10072 | }  | 
                                                        
| 10073 | - $sql .= " FROM " . $this->db->prefix() . "usergroup as ug ";  | 
                                                        |
| 10073 | + $sql .= " FROM ".$this->db->prefix()."usergroup as ug ";  | 
                                                        |
| 10074 | 10074 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
| 10075 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity";  | 
                                                        |
| 10075 | + $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";  | 
                                                        |
| 10076 | 10076 |  			if ($force_entity) { | 
                                                        
| 10077 | - $sql .= " WHERE ug.entity IN (0, " . $force_entity . ")";  | 
                                                        |
| 10077 | + $sql .= " WHERE ug.entity IN (0, ".$force_entity.")";  | 
                                                        |
| 10078 | 10078 |  			} else { | 
                                                        
| 10079 | 10079 | $sql .= " WHERE ug.entity IS NOT NULL";  | 
                                                        
| 10080 | 10080 | }  | 
                                                        
| 10081 | 10081 |  		} else { | 
                                                        
| 10082 | - $sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")";  | 
                                                        |
| 10082 | + $sql .= " WHERE ug.entity IN (0, ".$conf->entity.")";  | 
                                                        |
| 10083 | 10083 | }  | 
                                                        
| 10084 | 10084 |  		if (is_array($exclude) && $excludeGroups) { | 
                                                        
| 10085 | -			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; | 
                                                        |
| 10085 | +			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; | 
                                                        |
| 10086 | 10086 | }  | 
                                                        
| 10087 | 10087 |  		if (is_array($include) && $includeGroups) { | 
                                                        
| 10088 | -			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; | 
                                                        |
| 10088 | +			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; | 
                                                        |
| 10089 | 10089 | }  | 
                                                        
| 10090 | 10090 | $sql .= " ORDER BY ug.nom ASC";  | 
                                                        
| 10091 | 10091 | |
| 10092 | - dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);  | 
                                                        |
| 10092 | + dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);  | 
                                                        |
| 10093 | 10093 | $resql = $this->db->query($sql);  | 
                                                        
| 10094 | 10094 |  		if ($resql) { | 
                                                        
| 10095 | 10095 | // Enhance with select2  | 
                                                        
| 10096 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 10096 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 10097 | 10097 | |
| 10098 | - $out .= '<select class="flat minwidth200' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 10098 | + $out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 10099 | 10099 | |
| 10100 | 10100 | $num = $this->db->num_rows($resql);  | 
                                                        
| 10101 | 10101 | $i = 0;  | 
                                                        
| 10102 | 10102 |  			if ($num) { | 
                                                        
| 10103 | 10103 |  				if ($show_empty && !$multiple) { | 
                                                        
| 10104 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n";  | 
                                                        |
| 10104 | + $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n";  | 
                                                        |
| 10105 | 10105 | }  | 
                                                        
| 10106 | 10106 | |
| 10107 | 10107 |  				while ($i < $num) { | 
                                                        
@@ -10114,11 +10114,11 @@ discard block  | 
                                                    ||
| 10114 | 10114 | $label = $obj->name;  | 
                                                        
| 10115 | 10115 | $labelhtml = $obj->name;  | 
                                                        
| 10116 | 10116 |  					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { | 
                                                        
| 10117 | -						$label .= " (" . $obj->label . ")"; | 
                                                        |
| 10118 | -						$labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; | 
                                                        |
| 10117 | +						$label .= " (".$obj->label.")"; | 
                                                        |
| 10118 | +						$labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; | 
                                                        |
| 10119 | 10119 | }  | 
                                                        
| 10120 | 10120 | |
| 10121 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 10121 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 10122 | 10122 |  					if ($disableline) { | 
                                                        
| 10123 | 10123 | $out .= ' disabled';  | 
                                                        
| 10124 | 10124 | }  | 
                                                        
@@ -10134,9 +10134,9 @@ discard block  | 
                                                    ||
| 10134 | 10134 | }  | 
                                                        
| 10135 | 10135 |  			} else { | 
                                                        
| 10136 | 10136 |  				if ($show_empty) { | 
                                                        
| 10137 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";  | 
                                                        |
| 10137 | + $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";  | 
                                                        |
| 10138 | 10138 | }  | 
                                                        
| 10139 | -				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; | 
                                                        |
| 10139 | +				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; | 
                                                        |
| 10140 | 10140 | }  | 
                                                        
| 10141 | 10141 | $out .= '</select>';  | 
                                                        
| 10142 | 10142 | |
@@ -10185,25 +10185,25 @@ discard block  | 
                                                    ||
| 10185 | 10185 | $out = '';  | 
                                                        
| 10186 | 10186 | |
| 10187 | 10187 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 10188 | - $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>';  | 
                                                        |
| 10188 | + $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>';  | 
                                                        |
| 10189 | 10189 | }  | 
                                                        
| 10190 | - $out .= '<script nonce="' . getNonce() . '">  | 
                                                        |
| 10190 | + $out .= '<script nonce="'.getNonce().'">  | 
                                                        |
| 10191 | 10191 |              $(document).ready(function() { | 
                                                        
| 10192 | -                $("#' . $cssclass . 's").click(function() { | 
                                                        |
| 10192 | +                $("#' . $cssclass.'s").click(function() { | 
                                                        |
| 10193 | 10193 |                      if($(this).is(\':checked\')){ | 
                                                        
| 10194 | -                        console.log("We check all ' . $cssclass . ' and trigger the change method"); | 
                                                        |
| 10195 | -                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); | 
                                                        |
| 10194 | +                        console.log("We check all ' . $cssclass.' and trigger the change method"); | 
                                                        |
| 10195 | +                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); | 
                                                        |
| 10196 | 10196 | }  | 
                                                        
| 10197 | 10197 | else  | 
                                                        
| 10198 | 10198 |                      { | 
                                                        
| 10199 | 10199 |                          console.log("We uncheck all"); | 
                                                        
| 10200 | -                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); | 
                                                        |
| 10200 | +                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); | 
                                                        |
| 10201 | 10201 | }' . "\n";  | 
                                                        
| 10202 | 10202 |  		if ($calljsfunction) { | 
                                                        
| 10203 | -			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; | 
                                                        |
| 10203 | +			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; | 
                                                        |
| 10204 | 10204 | }  | 
                                                        
| 10205 | 10205 | $out .= ' });  | 
                                                        
| 10206 | -        	        $(".' . $cssclass . '").change(function() { | 
                                                        |
| 10206 | +        	        $(".' . $cssclass.'").change(function() { | 
                                                        |
| 10207 | 10207 |  					$(this).closest("tr").toggleClass("highlight", this.checked); | 
                                                        
| 10208 | 10208 | });  | 
                                                        
| 10209 | 10209 | });  | 
                                                        
@@ -10248,67 +10248,67 @@ discard block  | 
                                                    ||
| 10248 | 10248 | global $langs, $user;  | 
                                                        
| 10249 | 10249 | |
| 10250 | 10250 | $out = '';  | 
                                                        
| 10251 | - $sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1";  | 
                                                        |
| 10252 | -		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; | 
                                                        |
| 10251 | + $sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";  | 
                                                        |
| 10252 | +		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; | 
                                                        |
| 10253 | 10253 |  		if (!empty($excludeid)) { | 
                                                        
| 10254 | -			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; | 
                                                        |
| 10254 | +			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; | 
                                                        |
| 10255 | 10255 | }  | 
                                                        
| 10256 | 10256 | $sql .= " ORDER BY label";  | 
                                                        
| 10257 | 10257 | |
| 10258 | 10258 | $resql = $this->db->query($sql);  | 
                                                        
| 10259 | 10259 |  		if ($resql) { | 
                                                        
| 10260 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">';  | 
                                                        |
| 10260 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';  | 
                                                        |
| 10261 | 10261 |  			if ($useempty) { | 
                                                        
| 10262 | 10262 | $out .= '<option value="0"> </option>';  | 
                                                        
| 10263 | 10263 | }  | 
                                                        
| 10264 | 10264 | |
| 10265 | 10265 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
| 10266 | - $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';  | 
                                                        |
| 10266 | + $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';  | 
                                                        |
| 10267 | 10267 | }  | 
                                                        
| 10268 | 10268 | $out .= '</select>';  | 
                                                        
| 10269 | -			$out .= ajax_combobox('select_' . $htmlname); | 
                                                        |
| 10269 | +			$out .= ajax_combobox('select_'.$htmlname); | 
                                                        |
| 10270 | 10270 | |
| 10271 | 10271 |  			if (!empty($htmlname) && $user->admin && $info_admin) { | 
                                                        
| 10272 | -				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        |
| 10272 | +				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        |
| 10273 | 10273 | }  | 
                                                        
| 10274 | 10274 | |
| 10275 | 10275 |  			if (!empty($target)) { | 
                                                        
| 10276 | - $sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";  | 
                                                        |
| 10276 | + $sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";  | 
                                                        |
| 10277 | 10277 | $resql = $this->db->query($sql);  | 
                                                        
| 10278 | 10278 |  				if ($resql) { | 
                                                        
| 10279 | 10279 |  					if ($this->db->num_rows($resql) > 0) { | 
                                                        
| 10280 | 10280 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 10281 | - $out .= '<script nonce="' . getNonce() . '">  | 
                                                        |
| 10281 | + $out .= '<script nonce="'.getNonce().'">  | 
                                                        |
| 10282 | 10282 |  							$(function() { | 
                                                        
| 10283 | -								$("select[name=' . $target . ']").on("change", function() { | 
                                                        |
| 10283 | +								$("select[name=' . $target.']").on("change", function() { | 
                                                        |
| 10284 | 10284 | var current_val = $(this).val();  | 
                                                        
| 10285 | -									if (current_val == ' . $obj->id . ') {'; | 
                                                        |
| 10285 | +									if (current_val == ' . $obj->id.') {'; | 
                                                        |
| 10286 | 10286 |  						if (!empty($default_selected) || !empty($selected)) { | 
                                                        
| 10287 | -							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; | 
                                                        |
| 10287 | +							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; | 
                                                        |
| 10288 | 10288 | }  | 
                                                        
| 10289 | 10289 | |
| 10290 | 10290 | $out .= '  | 
                                                        
| 10291 | -										$("select[name=' . $htmlname . ']").change(); | 
                                                        |
| 10291 | +										$("select[name=' . $htmlname.']").change(); | 
                                                        |
| 10292 | 10292 | }  | 
                                                        
| 10293 | 10293 | });  | 
                                                        
| 10294 | 10294 | |
| 10295 | -								$("select[name=' . $htmlname . ']").change(function() { | 
                                                        |
| 10295 | +								$("select[name=' . $htmlname.']").change(function() { | 
                                                        |
| 10296 | 10296 | |
| 10297 | -									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { | 
                                                        |
| 10297 | +									if ($("select[name=' . $target.']").val() == '.$obj->id.') { | 
                                                        |
| 10298 | 10298 | // get price of kilometer to fill the unit price  | 
                                                        
| 10299 | 10299 |  										$.ajax({ | 
                                                        
| 10300 | 10300 | method: "POST",  | 
                                                        
| 10301 | 10301 | dataType: "json",  | 
                                                        
| 10302 | -											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, | 
                                                        |
| 10303 | -											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . join('&', $params)) . '", | 
                                                        |
| 10302 | +											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, | 
                                                        |
| 10303 | +											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.join('&', $params)).'", | 
                                                        |
| 10304 | 10304 |  										}).done(function( data, textStatus, jqXHR ) { | 
                                                        
| 10305 | 10305 | console.log(data);  | 
                                                        
| 10306 | 10306 |  											if (typeof data.up != "undefined") { | 
                                                        
| 10307 | 10307 |  												$("input[name=value_unit]").val(data.up); | 
                                                        
| 10308 | -												$("select[name=' . $htmlname . ']").attr("title", data.title); | 
                                                        |
| 10308 | +												$("select[name=' . $htmlname.']").attr("title", data.title); | 
                                                        |
| 10309 | 10309 |  											} else { | 
                                                        
| 10310 | 10310 |  												$("input[name=value_unit]").val(""); | 
                                                        
| 10311 | -												$("select[name=' . $htmlname . ']").attr("title", ""); | 
                                                        |
| 10311 | +												$("select[name=' . $htmlname.']").attr("title", ""); | 
                                                        |
| 10312 | 10312 | }  | 
                                                        
| 10313 | 10313 | });  | 
                                                        
| 10314 | 10314 | }  | 
                                                        
@@ -10338,18 +10338,18 @@ discard block  | 
                                                    ||
| 10338 | 10338 | global $conf, $langs;  | 
                                                        
| 10339 | 10339 | |
| 10340 | 10340 | $out = '';  | 
                                                        
| 10341 | - $sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range";  | 
                                                        |
| 10342 | - $sql .= " WHERE entity = " . $conf->entity . " AND active = 1";  | 
                                                        |
| 10341 | + $sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";  | 
                                                        |
| 10342 | + $sql .= " WHERE entity = ".$conf->entity." AND active = 1";  | 
                                                        |
| 10343 | 10343 | |
| 10344 | 10344 | $resql = $this->db->query($sql);  | 
                                                        
| 10345 | 10345 |  		if ($resql) { | 
                                                        
| 10346 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';  | 
                                                        |
| 10346 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';  | 
                                                        |
| 10347 | 10347 |  			if ($useempty) { | 
                                                        
| 10348 | 10348 | $out .= '<option value="0"></option>';  | 
                                                        
| 10349 | 10349 | }  | 
                                                        
| 10350 | 10350 | |
| 10351 | 10351 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
| 10352 | - $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';  | 
                                                        |
| 10352 | + $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';  | 
                                                        |
| 10353 | 10353 | }  | 
                                                        
| 10354 | 10354 | $out .= '</select>';  | 
                                                        
| 10355 | 10355 |  		} else { | 
                                                        
@@ -10374,17 +10374,17 @@ discard block  | 
                                                    ||
| 10374 | 10374 | global $langs;  | 
                                                        
| 10375 | 10375 | |
| 10376 | 10376 | $out = '';  | 
                                                        
| 10377 | - $sql = "SELECT id, code, label FROM " . $this->db->prefix() . "c_type_fees";  | 
                                                        |
| 10377 | + $sql = "SELECT id, code, label FROM ".$this->db->prefix()."c_type_fees";  | 
                                                        |
| 10378 | 10378 | $sql .= " WHERE active = 1";  | 
                                                        
| 10379 | 10379 | |
| 10380 | 10380 | $resql = $this->db->query($sql);  | 
                                                        
| 10381 | 10381 |  		if ($resql) { | 
                                                        
| 10382 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';  | 
                                                        |
| 10382 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';  | 
                                                        |
| 10383 | 10383 |  			if ($useempty) { | 
                                                        
| 10384 | 10384 | $out .= '<option value="0"></option>';  | 
                                                        
| 10385 | 10385 | }  | 
                                                        
| 10386 | 10386 |  			if ($allchoice) { | 
                                                        
| 10387 | -				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; | 
                                                        |
| 10387 | +				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; | 
                                                        |
| 10388 | 10388 | }  | 
                                                        
| 10389 | 10389 | |
| 10390 | 10390 | $field = 'code';  | 
                                                        
@@ -10394,7 +10394,7 @@ discard block  | 
                                                    ||
| 10394 | 10394 | |
| 10395 | 10395 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
| 10396 | 10396 | $key = $langs->trans($obj->code);  | 
                                                        
| 10397 | -				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; | 
                                                        |
| 10397 | +				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; | 
                                                        |
| 10398 | 10398 | }  | 
                                                        
| 10399 | 10399 | $out .= '</select>';  | 
                                                        
| 10400 | 10400 |  		} else { | 
                                                        
@@ -10426,7 +10426,7 @@ discard block  | 
                                                    ||
| 10426 | 10426 |  	{ | 
                                                        
| 10427 | 10427 | global $user, $conf, $langs;  | 
                                                        
| 10428 | 10428 | |
| 10429 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 10429 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 10430 | 10430 | |
| 10431 | 10431 |  		if (is_null($usertofilter)) { | 
                                                        
| 10432 | 10432 | $usertofilter = $user;  | 
                                                        
@@ -10450,10 +10450,10 @@ discard block  | 
                                                    ||
| 10450 | 10450 | $sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,  | 
                                                        
| 10451 | 10451 | p.title, p.fk_soc, p.fk_statut, p.public,";  | 
                                                        
| 10452 | 10452 | $sql .= ' s.nom as name';  | 
                                                        
| 10453 | - $sql .= ' FROM ' . $this->db->prefix() . 'projet as p';  | 
                                                        |
| 10454 | - $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,';  | 
                                                        |
| 10455 | - $sql .= ' ' . $this->db->prefix() . 'facture as f';  | 
                                                        |
| 10456 | -		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; | 
                                                        |
| 10453 | + $sql .= ' FROM '.$this->db->prefix().'projet as p';  | 
                                                        |
| 10454 | + $sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';  | 
                                                        |
| 10455 | + $sql .= ' '.$this->db->prefix().'facture as f';  | 
                                                        |
| 10456 | +		$sql .= " WHERE p.entity IN (".getEntity('project').")"; | 
                                                        |
| 10457 | 10457 | $sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement  | 
                                                        
| 10458 | 10458 |  		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; | 
                                                        
| 10459 | 10459 | //if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";  | 
                                                        
@@ -10464,14 +10464,14 @@ discard block  | 
                                                    ||
| 10464 | 10464 |  		if ($resql) { | 
                                                        
| 10465 | 10465 | // Use select2 selector  | 
                                                        
| 10466 | 10466 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 10467 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 10467 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 10468 | 10468 | $comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);  | 
                                                        
| 10469 | 10469 | $out .= $comboenhancement;  | 
                                                        
| 10470 | 10470 | $morecss = 'minwidth200imp maxwidth500';  | 
                                                        
| 10471 | 10471 | }  | 
                                                        
| 10472 | 10472 | |
| 10473 | 10473 |  			if (empty($option_only)) { | 
                                                        
| 10474 | - $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 10474 | + $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 10475 | 10475 | }  | 
                                                        
| 10476 | 10476 |  			if (!empty($show_empty)) { | 
                                                        
| 10477 | 10477 | $out .= '<option value="0" class="optiongrey">';  | 
                                                        
@@ -10501,33 +10501,33 @@ discard block  | 
                                                    ||
| 10501 | 10501 |  						if ($showproject == 'all') { | 
                                                        
| 10502 | 10502 | $labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref  | 
                                                        
| 10503 | 10503 |  							if ($obj->name) { | 
                                                        
| 10504 | - $labeltoshow .= ' - ' . $obj->name; // Soc name  | 
                                                        |
| 10504 | + $labeltoshow .= ' - '.$obj->name; // Soc name  | 
                                                        |
| 10505 | 10505 | }  | 
                                                        
| 10506 | 10506 | |
| 10507 | 10507 | $disabled = 0;  | 
                                                        
| 10508 | 10508 |  							if ($obj->fk_statut == Project::STATUS_DRAFT) { | 
                                                        
| 10509 | 10509 | $disabled = 1;  | 
                                                        
| 10510 | -								$labeltoshow .= ' - ' . $langs->trans("Draft"); | 
                                                        |
| 10510 | +								$labeltoshow .= ' - '.$langs->trans("Draft"); | 
                                                        |
| 10511 | 10511 |  							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) { | 
                                                        
| 10512 | 10512 |  								if ($discard_closed == 2) { | 
                                                        
| 10513 | 10513 | $disabled = 1;  | 
                                                        
| 10514 | 10514 | }  | 
                                                        
| 10515 | -								$labeltoshow .= ' - ' . $langs->trans("Closed"); | 
                                                        |
| 10515 | +								$labeltoshow .= ' - '.$langs->trans("Closed"); | 
                                                        |
| 10516 | 10516 |  							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { | 
                                                        
| 10517 | 10517 | $disabled = 1;  | 
                                                        
| 10518 | -								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); | 
                                                        |
| 10518 | +								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); | 
                                                        |
| 10519 | 10519 | }  | 
                                                        
| 10520 | 10520 | }  | 
                                                        
| 10521 | 10521 | |
| 10522 | 10522 |  						if (!empty($selected) && $selected == $obj->rowid) { | 
                                                        
| 10523 | - $out .= '<option value="' . $obj->rowid . '" selected';  | 
                                                        |
| 10523 | + $out .= '<option value="'.$obj->rowid.'" selected';  | 
                                                        |
| 10524 | 10524 | //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled  | 
                                                        
| 10525 | - $out .= '>' . $labeltoshow . '</option>';  | 
                                                        |
| 10525 | + $out .= '>'.$labeltoshow.'</option>';  | 
                                                        |
| 10526 | 10526 |  						} else { | 
                                                        
| 10527 | 10527 |  							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { | 
                                                        
| 10528 | 10528 | $resultat = '';  | 
                                                        
| 10529 | 10529 |  							} else { | 
                                                        
| 10530 | - $resultat = '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 10530 | + $resultat = '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 10531 | 10531 |  								if ($disabled) { | 
                                                        
| 10532 | 10532 | $resultat .= ' disabled';  | 
                                                        
| 10533 | 10533 | }  | 
                                                        
@@ -10579,22 +10579,22 @@ discard block  | 
                                                    ||
| 10579 | 10579 | |
| 10580 | 10580 | $sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';  | 
                                                        
| 10581 | 10581 | //$sql.= ', el.fk_source';  | 
                                                        
| 10582 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';  | 
                                                        |
| 10583 | -		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; | 
                                                        |
| 10582 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';  | 
                                                        |
| 10583 | +		$sql .= " WHERE f.entity IN (".getEntity('invoice').")"; | 
                                                        |
| 10584 | 10584 | $sql .= " ORDER BY f.titre ASC";  | 
                                                        
| 10585 | 10585 | |
| 10586 | 10586 | $resql = $this->db->query($sql);  | 
                                                        
| 10587 | 10587 |  		if ($resql) { | 
                                                        
| 10588 | 10588 | // Use select2 selector  | 
                                                        
| 10589 | 10589 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 10590 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 10590 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 10591 | 10591 | $comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);  | 
                                                        
| 10592 | 10592 | $out .= $comboenhancement;  | 
                                                        
| 10593 | 10593 | $morecss = 'minwidth200imp maxwidth500';  | 
                                                        
| 10594 | 10594 | }  | 
                                                        
| 10595 | 10595 | |
| 10596 | 10596 |  			if (empty($option_only)) { | 
                                                        
| 10597 | - $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 10597 | + $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 10598 | 10598 | }  | 
                                                        
| 10599 | 10599 |  			if (!empty($show_empty)) { | 
                                                        
| 10600 | 10600 | $out .= '<option value="0" class="optiongrey">';  | 
                                                        
@@ -10613,19 +10613,19 @@ discard block  | 
                                                    ||
| 10613 | 10613 | $disabled = 0;  | 
                                                        
| 10614 | 10614 |  					if (!empty($obj->suspended)) { | 
                                                        
| 10615 | 10615 | $disabled = 1;  | 
                                                        
| 10616 | -						$labeltoshow .= ' - ' . $langs->trans("Closed"); | 
                                                        |
| 10616 | +						$labeltoshow .= ' - '.$langs->trans("Closed"); | 
                                                        |
| 10617 | 10617 | }  | 
                                                        
| 10618 | 10618 | |
| 10619 | 10619 | |
| 10620 | 10620 |  					if (!empty($selected) && $selected == $obj->rowid) { | 
                                                        
| 10621 | - $out .= '<option value="' . $obj->rowid . '" selected';  | 
                                                        |
| 10621 | + $out .= '<option value="'.$obj->rowid.'" selected';  | 
                                                        |
| 10622 | 10622 | //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled  | 
                                                        
| 10623 | - $out .= '>' . $labeltoshow . '</option>';  | 
                                                        |
| 10623 | + $out .= '>'.$labeltoshow.'</option>';  | 
                                                        |
| 10624 | 10624 |  					} else { | 
                                                        
| 10625 | 10625 |  						if ($disabled && ($selected != $obj->rowid)) { | 
                                                        
| 10626 | 10626 | $resultat = '';  | 
                                                        
| 10627 | 10627 |  						} else { | 
                                                        
| 10628 | - $resultat = '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 10628 | + $resultat = '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 10629 | 10629 |  							if ($disabled) { | 
                                                        
| 10630 | 10630 | $resultat .= ' disabled';  | 
                                                        
| 10631 | 10631 | }  | 
                                                        
@@ -10665,14 +10665,14 @@ discard block  | 
                                                    ||
| 10665 | 10665 | global $langs;  | 
                                                        
| 10666 | 10666 | |
| 10667 | 10667 |  		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with () | 
                                                        
| 10668 | -			$search_component_params_hidden = '(' . $search_component_params_hidden . ')'; | 
                                                        |
| 10668 | +			$search_component_params_hidden = '('.$search_component_params_hidden.')'; | 
                                                        |
| 10669 | 10669 | }  | 
                                                        
| 10670 | 10670 | |
| 10671 | 10671 | $ret = '';  | 
                                                        
| 10672 | 10672 | |
| 10673 | 10673 | $ret .= '<div class="divadvancedsearchfieldcomp inline-block">';  | 
                                                        
| 10674 | 10674 | $ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';  | 
                                                        
| 10675 | -		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; | 
                                                        |
| 10675 | +		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; | 
                                                        |
| 10676 | 10676 | $ret .= '</a>';  | 
                                                        
| 10677 | 10677 | |
| 10678 | 10678 | $ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';  | 
                                                        
@@ -10699,13 +10699,13 @@ discard block  | 
                                                    ||
| 10699 | 10699 | }  | 
                                                        
| 10700 | 10700 | |
| 10701 | 10701 |  				if ($countparenthesis == 0) { | 
                                                        
| 10702 | - $char2 = dol_substr($search_component_params_hidden, $i+1, 1);  | 
                                                        |
| 10703 | - $char3 = dol_substr($search_component_params_hidden, $i+2, 1);  | 
                                                        |
| 10702 | + $char2 = dol_substr($search_component_params_hidden, $i + 1, 1);  | 
                                                        |
| 10703 | + $char3 = dol_substr($search_component_params_hidden, $i + 2, 1);  | 
                                                        |
| 10704 | 10704 |  					if ($char == 'A' && $char2 == 'N' && $char3 == 'D') { | 
                                                        
| 10705 | 10705 | // We found a AND  | 
                                                        
| 10706 | 10706 | $arrayofandtags[] = trim($s);  | 
                                                        
| 10707 | 10707 | $s = '';  | 
                                                        
| 10708 | - $i+=2;  | 
                                                        |
| 10708 | + $i += 2;  | 
                                                        |
| 10709 | 10709 |  					} else { | 
                                                        
| 10710 | 10710 | $s .= $char;  | 
                                                        
| 10711 | 10711 | }  | 
                                                        
@@ -10729,8 +10729,8 @@ discard block  | 
                                                    ||
| 10729 | 10729 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';  | 
                                                        
| 10730 | 10730 | $searchtags = removeGlobalParenthesis($searchtags);  | 
                                                        
| 10731 | 10731 | |
| 10732 | - $ret .= '<span class="marginleftonlyshort valignmiddle tagsearch" data-ufilterid="'.($tmpkey+1).'" data-ufilter="'.dol_escape_htmltag($tmpval).'">';  | 
                                                        |
| 10733 | - $ret .= '<span class="tagsearchdelete select2-selection__choice__remove" data-ufilterid="'.($tmpkey+1).'">x</span> ';  | 
                                                        |
| 10732 | + $ret .= '<span class="marginleftonlyshort valignmiddle tagsearch" data-ufilterid="'.($tmpkey + 1).'" data-ufilter="'.dol_escape_htmltag($tmpval).'">';  | 
                                                        |
| 10733 | + $ret .= '<span class="tagsearchdelete select2-selection__choice__remove" data-ufilterid="'.($tmpkey + 1).'">x</span> ';  | 
                                                        |
| 10734 | 10734 | $ret .= dol_escape_htmltag($searchtags);  | 
                                                        
| 10735 | 10735 | $ret .= '</span>';  | 
                                                        
| 10736 | 10736 | }  | 
                                                        
@@ -10747,29 +10747,29 @@ discard block  | 
                                                    ||
| 10747 | 10747 | $ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';  | 
                                                        
| 10748 | 10748 | }  | 
                                                        
| 10749 | 10749 | $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%')) -->";  | 
                                                        
| 10750 | - $ret .= '<input type="hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">';  | 
                                                        |
| 10750 | + $ret .= '<input type="hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';  | 
                                                        |
| 10751 | 10751 | // $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->";  | 
                                                        
| 10752 | 10752 | |
| 10753 | 10753 | // For compatibility with forms that show themself the search criteria in addition of this component, we output these fields  | 
                                                        
| 10754 | 10754 |  		foreach ($arrayofcriterias as $criteria) { | 
                                                        
| 10755 | 10755 |  			foreach ($criteria as $criteriafamilykey => $criteriafamilyval) { | 
                                                        
| 10756 | -				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { | 
                                                        |
| 10756 | +				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { | 
                                                        |
| 10757 | 10757 | continue;  | 
                                                        
| 10758 | 10758 | }  | 
                                                        
| 10759 | 10759 |  				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { | 
                                                        
| 10760 | 10760 | continue;  | 
                                                        
| 10761 | 10761 | }  | 
                                                        
| 10762 | 10762 |  				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { | 
                                                        
| 10763 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">';  | 
                                                        |
| 10764 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">';  | 
                                                        |
| 10765 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">';  | 
                                                        |
| 10766 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">';  | 
                                                        |
| 10767 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">';  | 
                                                        |
| 10768 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">';  | 
                                                        |
| 10769 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">';  | 
                                                        |
| 10770 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">';  | 
                                                        |
| 10763 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';  | 
                                                        |
| 10764 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';  | 
                                                        |
| 10765 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';  | 
                                                        |
| 10766 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';  | 
                                                        |
| 10767 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';  | 
                                                        |
| 10768 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';  | 
                                                        |
| 10769 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';  | 
                                                        |
| 10770 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';  | 
                                                        |
| 10771 | 10771 |  				} else { | 
                                                        
| 10772 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">';  | 
                                                        |
| 10772 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';  | 
                                                        |
| 10773 | 10773 | }  | 
                                                        
| 10774 | 10774 | }  | 
                                                        
| 10775 | 10775 | }  | 
                                                        
@@ -10777,7 +10777,7 @@ discard block  | 
                                                    ||
| 10777 | 10777 | $ret .= '</div>';  | 
                                                        
| 10778 | 10778 | |
| 10779 | 10779 | $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";  | 
                                                        
| 10780 | -		$ret .= '<input type="text" placeholder="' . $langs->trans("Search") . '" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; | 
                                                        |
| 10780 | +		$ret .= '<input type="text" placeholder="'.$langs->trans("Search").'" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; | 
                                                        |
| 10781 | 10781 | |
| 10782 | 10782 | $ret .= '</div>';  | 
                                                        
| 10783 | 10783 | $ret .= '</div>';  | 
                                                        
@@ -10813,7 +10813,7 @@ discard block  | 
                                                    ||
| 10813 | 10813 | |
| 10814 | 10814 | $TModels = array();  | 
                                                        
| 10815 | 10815 | |
| 10816 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';  | 
                                                        |
| 10816 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';  | 
                                                        |
| 10817 | 10817 | $formmail = new FormMail($this->db);  | 
                                                        
| 10818 | 10818 | $result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);  | 
                                                        
| 10819 | 10819 | |
@@ -10826,17 +10826,17 @@ discard block  | 
                                                    ||
| 10826 | 10826 | }  | 
                                                        
| 10827 | 10827 | }  | 
                                                        
| 10828 | 10828 | |
| 10829 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">';  | 
                                                        |
| 10829 | + $retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';  | 
                                                        |
| 10830 | 10830 | |
| 10831 | 10831 |  		foreach ($TModels as $id_model => $label_model) { | 
                                                        
| 10832 | - $retstring .= '<option value="' . $id_model . '"';  | 
                                                        |
| 10833 | - $retstring .= ">" . $label_model . "</option>";  | 
                                                        |
| 10832 | + $retstring .= '<option value="'.$id_model.'"';  | 
                                                        |
| 10833 | + $retstring .= ">".$label_model."</option>";  | 
                                                        |
| 10834 | 10834 | }  | 
                                                        
| 10835 | 10835 | |
| 10836 | 10836 | $retstring .= "</select>";  | 
                                                        
| 10837 | 10837 | |
| 10838 | 10838 |  		if ($addjscombo) { | 
                                                        
| 10839 | -			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); | 
                                                        |
| 10839 | +			$retstring .= ajax_combobox('select_'.$prefix.'model_mail'); | 
                                                        |
| 10840 | 10840 | }  | 
                                                        
| 10841 | 10841 | |
| 10842 | 10842 | return $retstring;  | 
                                                        
@@ -10887,16 +10887,16 @@ discard block  | 
                                                    ||
| 10887 | 10887 | |
| 10888 | 10888 |  		foreach ($buttons as $button) { | 
                                                        
| 10889 | 10889 | $addclass = empty($button['addclass']) ? '' : $button['addclass'];  | 
                                                        
| 10890 | - $retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">';  | 
                                                        |
| 10890 | + $retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';  | 
                                                        |
| 10891 | 10891 | }  | 
                                                        
| 10892 | 10892 | $retstring .= $withoutdiv ? '' : '</div>';  | 
                                                        
| 10893 | 10893 | |
| 10894 | 10894 |  		if ($dol_openinpopup) { | 
                                                        
| 10895 | - $retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . $dol_openinpopup . ' context, so we enable the close of dialog on cancel -->' . "\n";  | 
                                                        |
| 10896 | - $retstring .= '<script nonce="' . getNonce() . '">';  | 
                                                        |
| 10895 | + $retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n";  | 
                                                        |
| 10896 | + $retstring .= '<script nonce="'.getNonce().'">';  | 
                                                        |
| 10897 | 10897 |  			$retstring .= 'jQuery(".button-cancel").click(function(e) { | 
                                                        
| 10898 | - e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup . '\');  | 
                                                        |
| 10899 | - window.parent.jQuery(\'#idfordialog' . $dol_openinpopup . '\').dialog(\'close\');  | 
                                                        |
| 10898 | + e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup.'\');  | 
                                                        |
| 10899 | + window.parent.jQuery(\'#idfordialog' . $dol_openinpopup.'\').dialog(\'close\');  | 
                                                        |
| 10900 | 10900 | });';  | 
                                                        
| 10901 | 10901 | $retstring .= '</script>';  | 
                                                        
| 10902 | 10902 | }  | 
                                                        
@@ -10925,7 +10925,7 @@ discard block  | 
                                                    ||
| 10925 | 10925 | dol_syslog(__METHOD__, LOG_DEBUG);  | 
                                                        
| 10926 | 10926 | |
| 10927 | 10927 | $sql = "SELECT rowid, code, label as label";  | 
                                                        
| 10928 | - $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';  | 
                                                        |
| 10928 | + $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';  | 
                                                        |
| 10929 | 10929 | $sql .= " WHERE active = 1";  | 
                                                        
| 10930 | 10930 | |
| 10931 | 10931 | $resql = $this->db->query($sql);  | 
                                                        
@@ -10936,7 +10936,7 @@ discard block  | 
                                                    ||
| 10936 | 10936 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 10937 | 10937 | |
| 10938 | 10938 | // If translation exists, we use it, otherwise we take the default wording  | 
                                                        
| 10939 | -				$label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); | 
                                                        |
| 10939 | +				$label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); | 
                                                        |
| 10940 | 10940 | $this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid;  | 
                                                        
| 10941 | 10941 | $this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 10942 | 10942 | $this->cache_invoice_subtype[$obj->rowid]['label'] = $label;  | 
                                                        
@@ -10968,18 +10968,18 @@ discard block  | 
                                                    ||
| 10968 | 10968 | global $langs, $user;  | 
                                                        
| 10969 | 10969 | |
| 10970 | 10970 | $out = '';  | 
                                                        
| 10971 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 10971 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 10972 | 10972 | |
| 10973 | 10973 | $this->load_cache_invoice_subtype();  | 
                                                        
| 10974 | 10974 | |
| 10975 | - $out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 10975 | + $out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 10976 | 10976 |  		if ($addempty) { | 
                                                        
| 10977 | 10977 | $out .= '<option value="0"> </option>';  | 
                                                        
| 10978 | 10978 | }  | 
                                                        
| 10979 | 10979 | |
| 10980 | 10980 |  		foreach ($this->cache_invoice_subtype as $rowid => $subtype) { | 
                                                        
| 10981 | 10981 | $label = $subtype['label'];  | 
                                                        
| 10982 | - $out .= '<option value="' . $subtype['rowid'] . '"';  | 
                                                        |
| 10982 | + $out .= '<option value="'.$subtype['rowid'].'"';  | 
                                                        |
| 10983 | 10983 |  			if ($selected == $subtype['rowid']) { | 
                                                        
| 10984 | 10984 | $out .= ' selected="selected"';  | 
                                                        
| 10985 | 10985 | }  | 
                                                        
@@ -26,9 +26,9 @@ discard block  | 
                                                    ||
| 26 | 26 | * \brief File of class to generate the form for creating a new ticket.  | 
                                                        
| 27 | 27 | */  | 
                                                        
| 28 | 28 | |
| 29 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';  | 
                                                        |
| 30 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';  | 
                                                        |
| 31 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';  | 
                                                        |
| 29 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';  | 
                                                        |
| 30 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';  | 
                                                        |
| 31 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';  | 
                                                        |
| 32 | 32 | |
| 33 | 33 |  if (!class_exists('FormCompany')) { | 
                                                        
| 34 | 34 | include DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';  | 
                                                        
@@ -82,17 +82,17 @@ discard block  | 
                                                    ||
| 82 | 82 | |
| 83 | 83 | public $backtopage;  | 
                                                        
| 84 | 84 | |
| 85 | - public $ispublic; // to show information or not into public form  | 
                                                        |
| 85 | + public $ispublic; // to show information or not into public form  | 
                                                        |
| 86 | 86 | |
| 87 | 87 | public $withtitletopic;  | 
                                                        
| 88 | 88 | public $withtopicreadonly;  | 
                                                        
| 89 | 89 | public $withreadid;  | 
                                                        
| 90 | 90 | |
| 91 | - public $withcompany; // to show company drop-down list  | 
                                                        |
| 91 | + public $withcompany; // to show company drop-down list  | 
                                                        |
| 92 | 92 | public $withfromsocid;  | 
                                                        
| 93 | 93 | public $withfromcontactid;  | 
                                                        
| 94 | 94 | public $withnotifytiersatcreate;  | 
                                                        
| 95 | - public $withusercreate; // to show name of creating user in form  | 
                                                        |
| 95 | + public $withusercreate; // to show name of creating user in form  | 
                                                        |
| 96 | 96 | public $withcreatereadonly;  | 
                                                        
| 97 | 97 | |
| 98 | 98 | /**  | 
                                                        
@@ -100,7 +100,7 @@ discard block  | 
                                                    ||
| 100 | 100 | */  | 
                                                        
| 101 | 101 | public $withextrafields;  | 
                                                        
| 102 | 102 | |
| 103 | - public $withref; // to show ref field  | 
                                                        |
| 103 | + public $withref; // to show ref field  | 
                                                        |
| 104 | 104 | public $withcancel;  | 
                                                        
| 105 | 105 | |
| 106 | 106 | public $type_code;  | 
                                                        
@@ -138,14 +138,14 @@ discard block  | 
                                                    ||
| 138 | 138 |  		$this->withcompany = isModEnabled("societe"); | 
                                                        
| 139 | 139 | $this->withfromsocid = 0;  | 
                                                        
| 140 | 140 | $this->withfromcontactid = 0;  | 
                                                        
| 141 | - $this->withreadid=0;  | 
                                                        |
| 141 | + $this->withreadid = 0;  | 
                                                        |
| 142 | 142 | //$this->withtitletopic='';  | 
                                                        
| 143 | 143 | $this->withnotifytiersatcreate = 0;  | 
                                                        
| 144 | 144 | $this->withusercreate = 1;  | 
                                                        
| 145 | 145 | $this->withcreatereadonly = 1;  | 
                                                        
| 146 | 146 | $this->withemail = 0;  | 
                                                        
| 147 | 147 | $this->withref = 0;  | 
                                                        
| 148 | - $this->withextrafields = 0; // to show extrafields or not  | 
                                                        |
| 148 | + $this->withextrafields = 0; // to show extrafields or not  | 
                                                        |
| 149 | 149 | //$this->withtopicreadonly=0;  | 
                                                        
| 150 | 150 | }  | 
                                                        
| 151 | 151 | |
@@ -217,7 +217,7 @@ discard block  | 
                                                    ||
| 217 | 217 | $html_contact_search = '';  | 
                                                        
| 218 | 218 | $html_contact_search .= '<tr id="contact_search_line">';  | 
                                                        
| 219 | 219 | $html_contact_search .= '<td class="titlefield">';  | 
                                                        
| 220 | -				$html_contact_search .= '<label for="contact"><span class="fieldrequired">' . $langs->trans('Contact') . '</span></label>'; | 
                                                        |
| 220 | +				$html_contact_search .= '<label for="contact"><span class="fieldrequired">'.$langs->trans('Contact').'</span></label>'; | 
                                                        |
| 221 | 221 | $html_contact_search .= '<input type="hidden" id="contact_id" name="contact_id" value="" />';  | 
                                                        
| 222 | 222 | $html_contact_search .= '</td>';  | 
                                                        
| 223 | 223 | $html_contact_search .= '<td id="contact_search_result"></td>';  | 
                                                        
@@ -225,26 +225,26 @@ discard block  | 
                                                    ||
| 225 | 225 | print $html_contact_search;  | 
                                                        
| 226 | 226 | // contact lastname  | 
                                                        
| 227 | 227 | $html_contact_lastname = '';  | 
                                                        
| 228 | -				$html_contact_lastname .= '<tr id="contact_lastname_line" class="contact_field"><td class="titlefield"><label for="contact_lastname"><span class="fieldrequired">' . $langs->trans('Lastname') . '</span></label></td><td>'; | 
                                                        |
| 229 | -				$html_contact_lastname .= '<input type="text" id="contact_lastname" name="contact_lastname" value="' . dol_escape_htmltag(GETPOSTISSET('contact_lastname') ? GETPOST('contact_lastname', 'alphanohtml') : '') . '" />'; | 
                                                        |
| 228 | +				$html_contact_lastname .= '<tr id="contact_lastname_line" class="contact_field"><td class="titlefield"><label for="contact_lastname"><span class="fieldrequired">'.$langs->trans('Lastname').'</span></label></td><td>'; | 
                                                        |
| 229 | +				$html_contact_lastname .= '<input type="text" id="contact_lastname" name="contact_lastname" value="'.dol_escape_htmltag(GETPOSTISSET('contact_lastname') ? GETPOST('contact_lastname', 'alphanohtml') : '').'" />'; | 
                                                        |
| 230 | 230 | $html_contact_lastname .= '</td></tr>';  | 
                                                        
| 231 | 231 | print $html_contact_lastname;  | 
                                                        
| 232 | 232 | // contact firstname  | 
                                                        
| 233 | 233 | $html_contact_firstname = '';  | 
                                                        
| 234 | -				$html_contact_firstname .= '<tr id="contact_firstname_line" class="contact_field"><td class="titlefield"><label for="contact_firstname"><span class="fieldrequired">' . $langs->trans('Firstname') . '</span></label></td><td>'; | 
                                                        |
| 235 | -				$html_contact_firstname .= '<input type="text" id="contact_firstname" name="contact_firstname" value="' . dol_escape_htmltag(GETPOSTISSET('contact_firstname') ? GETPOST('contact_firstname', 'alphanohtml') : '') . '" />'; | 
                                                        |
| 234 | +				$html_contact_firstname .= '<tr id="contact_firstname_line" class="contact_field"><td class="titlefield"><label for="contact_firstname"><span class="fieldrequired">'.$langs->trans('Firstname').'</span></label></td><td>'; | 
                                                        |
| 235 | +				$html_contact_firstname .= '<input type="text" id="contact_firstname" name="contact_firstname" value="'.dol_escape_htmltag(GETPOSTISSET('contact_firstname') ? GETPOST('contact_firstname', 'alphanohtml') : '').'" />'; | 
                                                        |
| 236 | 236 | $html_contact_firstname .= '</td></tr>';  | 
                                                        
| 237 | 237 | print $html_contact_firstname;  | 
                                                        
| 238 | 238 | // company name  | 
                                                        
| 239 | 239 | $html_company_name = '';  | 
                                                        
| 240 | -				$html_company_name .= '<tr id="contact_company_name_line" class="contact_field"><td><label for="company_name"><span>' . $langs->trans('Company') . '</span></label></td><td>'; | 
                                                        |
| 241 | -				$html_company_name .= '<input type="text" id="company_name" name="company_name" value="' . dol_escape_htmltag(GETPOSTISSET('company_name') ? GETPOST('company_name', 'alphanohtml') : '') . '" />'; | 
                                                        |
| 240 | +				$html_company_name .= '<tr id="contact_company_name_line" class="contact_field"><td><label for="company_name"><span>'.$langs->trans('Company').'</span></label></td><td>'; | 
                                                        |
| 241 | +				$html_company_name .= '<input type="text" id="company_name" name="company_name" value="'.dol_escape_htmltag(GETPOSTISSET('company_name') ? GETPOST('company_name', 'alphanohtml') : '').'" />'; | 
                                                        |
| 242 | 242 | $html_company_name .= '</td></tr>';  | 
                                                        
| 243 | 243 | print $html_company_name;  | 
                                                        
| 244 | 244 | // contact phone  | 
                                                        
| 245 | 245 | $html_contact_phone = '';  | 
                                                        
| 246 | -				$html_contact_phone .= '<tr id="contact_phone_line" class="contact_field"><td><label for="contact_phone"><span>' . $langs->trans('Phone') . '</span></label></td><td>'; | 
                                                        |
| 247 | -				$html_contact_phone .= '<input type="text" id="contact_phone" name="contact_phone" value="' . dol_escape_htmltag(GETPOSTISSET('contact_phone') ? GETPOST('contact_phone', 'alphanohtml') : '') . '" />'; | 
                                                        |
| 246 | +				$html_contact_phone .= '<tr id="contact_phone_line" class="contact_field"><td><label for="contact_phone"><span>'.$langs->trans('Phone').'</span></label></td><td>'; | 
                                                        |
| 247 | +				$html_contact_phone .= '<input type="text" id="contact_phone" name="contact_phone" value="'.dol_escape_htmltag(GETPOSTISSET('contact_phone') ? GETPOST('contact_phone', 'alphanohtml') : '').'" />'; | 
                                                        |
| 248 | 248 | $html_contact_phone .= '</td></tr>';  | 
                                                        
| 249 | 249 | print $html_contact_phone;  | 
                                                        
| 250 | 250 | |
@@ -518,7 +518,7 @@ discard block  | 
                                                    ||
| 518 | 518 | $maxfilesizearray = getMaxFileSizeArray();  | 
                                                        
| 519 | 519 | $maxmin = $maxfilesizearray['maxmin'];  | 
                                                        
| 520 | 520 |  				if ($maxmin > 0) { | 
                                                        
| 521 | - $out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 521 | + $out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 522 | 522 | }  | 
                                                        
| 523 | 523 |  				$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />'; | 
                                                        
| 524 | 524 | $out .= ' ';  | 
                                                        
@@ -716,7 +716,7 @@ discard block  | 
                                                    ||
| 716 | 716 |  		$selected = is_array($selected) ? $selected : (!empty($selected) ? explode(',', $selected) : array()); | 
                                                        
| 717 | 717 | $ticketstat = new Ticket($this->db);  | 
                                                        
| 718 | 718 | |
| 719 | -		dol_syslog(get_class($this) . "::select_types_tickets " . implode(';', $selected) . ", " . $htmlname . ", " . $filtertype . ", " . $format . ", " . $multiselect, LOG_DEBUG); | 
                                                        |
| 719 | +		dol_syslog(get_class($this)."::select_types_tickets ".implode(';', $selected).", ".$htmlname.", ".$filtertype.", ".$format.", ".$multiselect, LOG_DEBUG); | 
                                                        |
| 720 | 720 | |
| 721 | 721 | $filterarray = array();  | 
                                                        
| 722 | 722 | |
@@ -822,7 +822,7 @@ discard block  | 
                                                    ||
| 822 | 822 | $publicgroups = ($filtertype == 'public=1' || $filtertype == '(public:=:1)');  | 
                                                        
| 823 | 823 | |
| 824 | 824 | $ticketstat = new Ticket($this->db);  | 
                                                        
| 825 | - $ticketstat->loadCacheCategoriesTickets($publicgroups ? 1 : -1); // get list of active ticket groups  | 
                                                        |
| 825 | + $ticketstat->loadCacheCategoriesTickets($publicgroups ? 1 : -1); // get list of active ticket groups  | 
                                                        |
| 826 | 826 | |
| 827 | 827 |  		if ($use_multilevel <= 0) { | 
                                                        
| 828 | 828 | print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        
@@ -910,8 +910,8 @@ discard block  | 
                                                    ||
| 910 | 910 |  		} elseif ($htmlname != '') { | 
                                                        
| 911 | 911 | $selectedgroups = array();  | 
                                                        
| 912 | 912 | $groupvalue = "";  | 
                                                        
| 913 | - $groupticket=GETPOST($htmlname, 'aZ09');  | 
                                                        |
| 914 | - $child_id=GETPOST($htmlname.'_child_id', 'aZ09') ? GETPOST($htmlname.'_child_id', 'aZ09') : 0;  | 
                                                        |
| 913 | + $groupticket = GETPOST($htmlname, 'aZ09');  | 
                                                        |
| 914 | + $child_id = GETPOST($htmlname.'_child_id', 'aZ09') ? GETPOST($htmlname.'_child_id', 'aZ09') : 0;  | 
                                                        |
| 915 | 915 |  			if (!empty($groupticket)) { | 
                                                        
| 916 | 916 | $tmpgroupticket = $groupticket;  | 
                                                        
| 917 | 917 | $sql = "SELECT ctc.rowid, ctc.fk_parent, ctc.code";  | 
                                                        
@@ -994,7 +994,7 @@ discard block  | 
                                                    ||
| 994 | 994 | }  | 
                                                        
| 995 | 995 | $stringtoprint .= '</select> ';  | 
                                                        
| 996 | 996 | |
| 997 | - $levelid = 1; // The first combobox  | 
                                                        |
| 997 | + $levelid = 1; // The first combobox  | 
                                                        |
| 998 | 998 |  			while ($levelid <= $use_multilevel) {	// Loop to take the child of the combo | 
                                                        
| 999 | 999 | $tabscript = array();  | 
                                                        
| 1000 | 1000 | $stringtoprint .= '<select id="'.$htmlname.'_child_'.$levelid.'" class="maxwidth500 minwidth400 groupticketchild" child_id="'.$levelid.'">';  | 
                                                        
@@ -1024,7 +1024,7 @@ discard block  | 
                                                    ||
| 1024 | 1024 |  				if ($resql) { | 
                                                        
| 1025 | 1025 | $num_rows = $this->db->num_rows($resql);  | 
                                                        
| 1026 | 1026 | $i = 0;  | 
                                                        
| 1027 | - $arrayidused=array();  | 
                                                        |
| 1027 | + $arrayidused = array();  | 
                                                        |
| 1028 | 1028 |  					while ($i < $num_rows) { | 
                                                        
| 1029 | 1029 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 1030 | 1030 |  						if ($obj) { | 
                                                        
@@ -1053,7 +1053,7 @@ discard block  | 
                                                    ||
| 1053 | 1053 | }  | 
                                                        
| 1054 | 1054 | $stringtoprint .= '<option '.$iselected.' class="'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'" value="'.dol_escape_htmltag($groupvalue).'" data-html="'.dol_escape_htmltag($grouplabel).'">'.dol_escape_htmltag($grouplabel).'</option>';  | 
                                                        
| 1055 | 1055 |  							if (empty($tabscript[$groupcodefather])) { | 
                                                        
| 1056 | -								$tabscript[$groupcodefather] = 'if ($("#'.$htmlname.($levelid > 1 ? '_child_'.($levelid-1) : '').'").val() == "'.dol_escape_js($groupcodefather).'"){ | 
                                                        |
| 1056 | +								$tabscript[$groupcodefather] = 'if ($("#'.$htmlname.($levelid > 1 ? '_child_'.($levelid - 1) : '').'").val() == "'.dol_escape_js($groupcodefather).'"){ | 
                                                        |
| 1057 | 1057 |  									$(".'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'").show() | 
                                                        
| 1058 | 1058 |  									console.log("We show child tickets of '.$groupcodefather.' group ticket") | 
                                                        
| 1059 | 1059 |  								}else{ | 
                                                        
@@ -1067,11 +1067,11 @@ discard block  | 
                                                    ||
| 1067 | 1067 |  				} else { | 
                                                        
| 1068 | 1068 | dol_print_error($this->db);  | 
                                                        
| 1069 | 1069 | }  | 
                                                        
| 1070 | - $stringtoprint .='</select>';  | 
                                                        |
| 1070 | + $stringtoprint .= '</select>';  | 
                                                        |
| 1071 | 1071 | |
| 1072 | - $stringtoprint .='<script nonce="'.getNonce().'">';  | 
                                                        |
| 1073 | - $stringtoprint .='arraynotparents = '.json_encode($arraycodenotparent).';'; // when the last visible combo list is number x, this is the array of group  | 
                                                        |
| 1074 | -				$stringtoprint .='if (arraynotparents.includes($("#'.$htmlname.($levelid > 1 ? '_child_'.($levelid-1) : '').'").val())){ | 
                                                        |
| 1072 | + $stringtoprint .= '<script nonce="'.getNonce().'">';  | 
                                                        |
| 1073 | + $stringtoprint .= 'arraynotparents = '.json_encode($arraycodenotparent).';'; // when the last visible combo list is number x, this is the array of group  | 
                                                        |
| 1074 | +				$stringtoprint .= 'if (arraynotparents.includes($("#'.$htmlname.($levelid > 1 ? '_child_'.($levelid - 1) : '').'").val())){ | 
                                                        |
| 1075 | 1075 |  					console.log("'.$htmlname.'_child_'.$levelid.'") | 
                                                        
| 1076 | 1076 |  					if($("#'.$htmlname.'_child_'.$levelid.'").val() == "" && ($("#'.$htmlname.'_child_'.$levelid.'").attr("child_id")>'.$child_id.')){ | 
                                                        
| 1077 | 1077 |  						$("#'.$htmlname.'_child_'.$levelid.'").hide(); | 
                                                        
@@ -1083,7 +1083,7 @@ discard block  | 
                                                    ||
| 1083 | 1083 |  						console.log("We choose '.$htmlname.' input and reload hidden input"); | 
                                                        
| 1084 | 1084 | }  | 
                                                        
| 1085 | 1085 | }  | 
                                                        
| 1086 | -				$("#'.$htmlname.($levelid > 1 ? '_child_'.($levelid-1) : '').'").change(function() { | 
                                                        |
| 1086 | +				$("#'.$htmlname.($levelid > 1 ? '_child_'.($levelid - 1) : '').'").change(function() { | 
                                                        |
| 1087 | 1087 |  					child_id = $("#'.$htmlname.($levelid > 1 ? '_child_'.$levelid : '').'").attr("child_id"); | 
                                                        
| 1088 | 1088 | |
| 1089 | 1089 | /* Change of value to select this value*/  | 
                                                        
@@ -1127,16 +1127,16 @@ discard block  | 
                                                    ||
| 1127 | 1127 |  				foreach ($tabscript as $script) { | 
                                                        
| 1128 | 1128 | $stringtoprint .= $script;  | 
                                                        
| 1129 | 1129 | }  | 
                                                        
| 1130 | - $stringtoprint .='})';  | 
                                                        |
| 1131 | - $stringtoprint .='</script>';  | 
                                                        |
| 1130 | + $stringtoprint .= '})';  | 
                                                        |
| 1131 | + $stringtoprint .= '</script>';  | 
                                                        |
| 1132 | 1132 | }  | 
                                                        
| 1133 | - $stringtoprint .='<script nonce="'.getNonce().'">';  | 
                                                        |
| 1134 | -			$stringtoprint .='$("#'.$htmlname.'_child_'.$use_multilevel.'").change(function() { | 
                                                        |
| 1133 | + $stringtoprint .= '<script nonce="'.getNonce().'">';  | 
                                                        |
| 1134 | +			$stringtoprint .= '$("#'.$htmlname.'_child_'.$use_multilevel.'").change(function() { | 
                                                        |
| 1135 | 1135 |  				$("#ticketcategory_select").val($(this).val()); | 
                                                        
| 1136 | 1136 |  				$("#ticketcategory_select_child_id").val($(this).attr("child_id")); | 
                                                        
| 1137 | 1137 |  				console.log($("#ticketcategory_select").val()); | 
                                                        
| 1138 | 1138 | })';  | 
                                                        
| 1139 | - $stringtoprint .='</script>';  | 
                                                        |
| 1139 | + $stringtoprint .= '</script>';  | 
                                                        |
| 1140 | 1140 | $stringtoprint .= ajax_combobox($htmlname);  | 
                                                        
| 1141 | 1141 | |
| 1142 | 1142 | return $stringtoprint;  | 
                                                        
@@ -152,15 +152,15 @@ discard block  | 
                                                    ||
| 152 | 152 | return $hookmanager->resPrint;  | 
                                                        
| 153 | 153 |  		} else { | 
                                                        
| 154 | 154 | $out = '<!-- Start generateOutput from FormSetup class -->';  | 
                                                        
| 155 | - $out.= $this->htmlBeforeOutputForm;  | 
                                                        |
| 155 | + $out .= $this->htmlBeforeOutputForm;  | 
                                                        |
| 156 | 156 | |
| 157 | 157 |  			if ($editMode) { | 
                                                        
| 158 | - $out.= '<form ' . self::generateAttributesStringFromArray($this->formAttributes) . ' >';  | 
                                                        |
| 158 | + $out .= '<form '.self::generateAttributesStringFromArray($this->formAttributes).' >';  | 
                                                        |
| 159 | 159 | |
| 160 | 160 | // generate hidden values from $this->formHiddenInputs  | 
                                                        
| 161 | 161 |  				if (!empty($this->formHiddenInputs) && is_array($this->formHiddenInputs)) { | 
                                                        
| 162 | 162 |  					foreach ($this->formHiddenInputs as $hiddenKey => $hiddenValue) { | 
                                                        
| 163 | - $out.= '<input type="hidden" name="'.dol_escape_htmltag($hiddenKey).'" value="' . dol_escape_htmltag($hiddenValue) . '">';  | 
                                                        |
| 163 | + $out .= '<input type="hidden" name="'.dol_escape_htmltag($hiddenKey).'" value="'.dol_escape_htmltag($hiddenValue).'">';  | 
                                                        |
| 164 | 164 | }  | 
                                                        
| 165 | 165 | }  | 
                                                        
| 166 | 166 | }  | 
                                                        
@@ -179,10 +179,10 @@ discard block  | 
                                                    ||
| 179 | 179 |  			} elseif ($editMode) { | 
                                                        
| 180 | 180 | $out .= '<br>'; // Todo : remove this <br/> by adding style to form-setup-button-container css class in all themes  | 
                                                        
| 181 | 181 | $out .= '<div class="form-setup-button-container center">'; // Todo : remove .center by adding style to form-setup-button-container css class in all themes  | 
                                                        
| 182 | - $out.= $this->htmlOutputMoreButton;  | 
                                                        |
| 183 | -				$out .= '<input class="button button-save" type="submit" value="' . $this->langs->trans("Save") . '">'; // Todo fix dolibarr style for <button and use <button instead of input | 
                                                        |
| 182 | + $out .= $this->htmlOutputMoreButton;  | 
                                                        |
| 183 | +				$out .= '<input class="button button-save" type="submit" value="'.$this->langs->trans("Save").'">'; // Todo fix dolibarr style for <button and use <button instead of input | 
                                                        |
| 184 | 184 | $out .= '    ';  | 
                                                        
| 185 | -				$out .= '<a class="button button-cancel" type="submit" href="' . $this->formAttributes['action'] . '">'.$langs->trans('Cancel').'</a>'; | 
                                                        |
| 185 | +				$out .= '<a class="button button-cancel" type="submit" href="'.$this->formAttributes['action'].'">'.$langs->trans('Cancel').'</a>'; | 
                                                        |
| 186 | 186 | $out .= '</div>';  | 
                                                        
| 187 | 187 | }  | 
                                                        
| 188 | 188 | |
@@ -190,7 +190,7 @@ discard block  | 
                                                    ||
| 190 | 190 | $out .= '</form>';  | 
                                                        
| 191 | 191 | }  | 
                                                        
| 192 | 192 | |
| 193 | - $out.= $this->htmlAfterOutputForm;  | 
                                                        |
| 193 | + $out .= $this->htmlAfterOutputForm;  | 
                                                        |
| 194 | 194 | |
| 195 | 195 | return $out;  | 
                                                        
| 196 | 196 | }  | 
                                                        
@@ -221,8 +221,8 @@ discard block  | 
                                                    ||
| 221 | 221 | $out = '<table class="noborder centpercent">';  | 
                                                        
| 222 | 222 | $out .= '<thead>';  | 
                                                        
| 223 | 223 | $out .= '<tr class="liste_titre">';  | 
                                                        
| 224 | -			$out .= '	<td>' . $this->langs->trans("Parameter") . '</td>'; | 
                                                        |
| 225 | -			$out .= '	<td>' . $this->langs->trans("Value") . '</td>'; | 
                                                        |
| 224 | +			$out .= '	<td>'.$this->langs->trans("Parameter").'</td>'; | 
                                                        |
| 225 | +			$out .= '	<td>'.$this->langs->trans("Value").'</td>'; | 
                                                        |
| 226 | 226 | $out .= '</tr>';  | 
                                                        
| 227 | 227 | $out .= '</thead>';  | 
                                                        
| 228 | 228 | |
@@ -307,27 +307,27 @@ discard block  | 
                                                    ||
| 307 | 307 | public function generateLineOutput($item, $editMode = false)  | 
                                                        
| 308 | 308 |  	{ | 
                                                        
| 309 | 309 | $out = '';  | 
                                                        
| 310 | -		if ($item->enabled==1) { | 
                                                        |
| 310 | +		if ($item->enabled == 1) { | 
                                                        |
| 311 | 311 | $trClass = 'oddeven';  | 
                                                        
| 312 | 312 |  			if ($item->getType() == 'title') { | 
                                                        
| 313 | 313 | $trClass = 'liste_titre';  | 
                                                        
| 314 | 314 | }  | 
                                                        
| 315 | 315 | |
| 316 | 316 | $this->setupNotEmpty++;  | 
                                                        
| 317 | - $out.= '<tr class="'.$trClass.'">';  | 
                                                        |
| 317 | + $out .= '<tr class="'.$trClass.'">';  | 
                                                        |
| 318 | 318 | |
| 319 | - $out.= '<td class="col-setup-title">';  | 
                                                        |
| 320 | - $out.= '<span id="helplink'.$item->confKey.'" class="spanforparamtooltip">';  | 
                                                        |
| 321 | - $out.= $this->form->textwithpicto($item->getNameText(), $item->getHelpText(), 1, 'info', '', 0, 3, 'tootips'.$item->confKey);  | 
                                                        |
| 322 | - $out.= '</span>';  | 
                                                        |
| 323 | - $out.= '</td>';  | 
                                                        |
| 319 | + $out .= '<td class="col-setup-title">';  | 
                                                        |
| 320 | + $out .= '<span id="helplink'.$item->confKey.'" class="spanforparamtooltip">';  | 
                                                        |
| 321 | + $out .= $this->form->textwithpicto($item->getNameText(), $item->getHelpText(), 1, 'info', '', 0, 3, 'tootips'.$item->confKey);  | 
                                                        |
| 322 | + $out .= '</span>';  | 
                                                        |
| 323 | + $out .= '</td>';  | 
                                                        |
| 324 | 324 | |
| 325 | - $out.= '<td>';  | 
                                                        |
| 325 | + $out .= '<td>';  | 
                                                        |
| 326 | 326 | |
| 327 | 327 |  			if ($editMode) { | 
                                                        
| 328 | - $out.= $item->generateInputField();  | 
                                                        |
| 328 | + $out .= $item->generateInputField();  | 
                                                        |
| 329 | 329 |  			} else { | 
                                                        
| 330 | - $out.= $item->generateOutputField();  | 
                                                        |
| 330 | + $out .= $item->generateOutputField();  | 
                                                        |
| 331 | 331 | }  | 
                                                        
| 332 | 332 | |
| 333 | 333 |  			if (!empty($item->errors)) { | 
                                                        
@@ -335,8 +335,8 @@ discard block  | 
                                                    ||
| 335 | 335 | setEventMessages(null, $item->errors, 'errors');  | 
                                                        
| 336 | 336 | }  | 
                                                        
| 337 | 337 | |
| 338 | - $out.= '</td>';  | 
                                                        |
| 339 | - $out.= '</tr>';  | 
                                                        |
| 338 | + $out .= '</td>';  | 
                                                        |
| 339 | + $out .= '</tr>';  | 
                                                        |
| 340 | 340 | }  | 
                                                        
| 341 | 341 | |
| 342 | 342 | return $out;  | 
                                                        
@@ -807,7 +807,7 @@ discard block  | 
                                                    ||
| 807 | 807 |  		if (!empty($this->helpText)) { | 
                                                        
| 808 | 808 | return $this->helpText;  | 
                                                        
| 809 | 809 | }  | 
                                                        
| 810 | - return (($this->langs->trans($this->confKey . 'Tooltip') != $this->confKey . 'Tooltip') ? $this->langs->trans($this->confKey . 'Tooltip') : '');  | 
                                                        |
| 810 | + return (($this->langs->trans($this->confKey.'Tooltip') != $this->confKey.'Tooltip') ? $this->langs->trans($this->confKey.'Tooltip') : '');  | 
                                                        |
| 811 | 811 | }  | 
                                                        
| 812 | 812 | |
| 813 | 813 | /**  | 
                                                        
@@ -853,47 +853,47 @@ discard block  | 
                                                    ||
| 853 | 853 | $out = '';  | 
                                                        
| 854 | 854 | |
| 855 | 855 |  		if ($this->type == 'title') { | 
                                                        
| 856 | - $out.= $this->generateOutputField(); // title have no input  | 
                                                        |
| 856 | + $out .= $this->generateOutputField(); // title have no input  | 
                                                        |
| 857 | 857 |  		} elseif ($this->type == 'multiselect') { | 
                                                        
| 858 | - $out.= $this->generateInputFieldMultiSelect();  | 
                                                        |
| 858 | + $out .= $this->generateInputFieldMultiSelect();  | 
                                                        |
| 859 | 859 |  		} elseif ($this->type == 'select') { | 
                                                        
| 860 | - $out.= $this->generateInputFieldSelect();  | 
                                                        |
| 860 | + $out .= $this->generateInputFieldSelect();  | 
                                                        |
| 861 | 861 |  		} elseif ($this->type == 'selectUser') { | 
                                                        
| 862 | - $out.= $this->generateInputFieldSelectUser();  | 
                                                        |
| 862 | + $out .= $this->generateInputFieldSelectUser();  | 
                                                        |
| 863 | 863 |  		} elseif ($this->type == 'textarea') { | 
                                                        
| 864 | - $out.= $this->generateInputFieldTextarea();  | 
                                                        |
| 865 | -		} elseif ($this->type== 'html') { | 
                                                        |
| 866 | - $out.= $this->generateInputFieldHtml();  | 
                                                        |
| 867 | -		} elseif ($this->type== 'color') { | 
                                                        |
| 868 | - $out.= $this->generateInputFieldColor();  | 
                                                        |
| 864 | + $out .= $this->generateInputFieldTextarea();  | 
                                                        |
| 865 | +		} elseif ($this->type == 'html') { | 
                                                        |
| 866 | + $out .= $this->generateInputFieldHtml();  | 
                                                        |
| 867 | +		} elseif ($this->type == 'color') { | 
                                                        |
| 868 | + $out .= $this->generateInputFieldColor();  | 
                                                        |
| 869 | 869 |  		} elseif ($this->type == 'yesno') { | 
                                                        
| 870 | 870 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 871 | - $out.= ajax_constantonoff($this->confKey);  | 
                                                        |
| 871 | + $out .= ajax_constantonoff($this->confKey);  | 
                                                        |
| 872 | 872 |  			} else { | 
                                                        
| 873 | - $out.= $this->form->selectyesno($this->confKey, $this->fieldValue, 1);  | 
                                                        |
| 873 | + $out .= $this->form->selectyesno($this->confKey, $this->fieldValue, 1);  | 
                                                        |
| 874 | 874 | }  | 
                                                        
| 875 | 875 |  		} elseif (preg_match('/emailtemplate:/', $this->type)) { | 
                                                        
| 876 | - $out.= $this->generateInputFieldEmailTemplate();  | 
                                                        |
| 876 | + $out .= $this->generateInputFieldEmailTemplate();  | 
                                                        |
| 877 | 877 |  		} elseif (preg_match('/category:/', $this->type)) { | 
                                                        
| 878 | - $out.=$this->generateInputFieldCategories();  | 
                                                        |
| 878 | + $out .= $this->generateInputFieldCategories();  | 
                                                        |
| 879 | 879 |  		} elseif (preg_match('/thirdparty_type/', $this->type)) { | 
                                                        
| 880 | 880 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';  | 
                                                        
| 881 | 881 | $formcompany = new FormCompany($this->db);  | 
                                                        
| 882 | - $out.= $formcompany->selectProspectCustomerType($this->fieldValue, $this->confKey);  | 
                                                        |
| 882 | + $out .= $formcompany->selectProspectCustomerType($this->fieldValue, $this->confKey);  | 
                                                        |
| 883 | 883 |  		} elseif ($this->type == 'securekey') { | 
                                                        
| 884 | - $out.= $this->generateInputFieldSecureKey();  | 
                                                        |
| 884 | + $out .= $this->generateInputFieldSecureKey();  | 
                                                        |
| 885 | 885 |  		} elseif ($this->type == 'product') { | 
                                                        
| 886 | 886 |  			if (isModEnabled("product") || isModEnabled("service")) { | 
                                                        
| 887 | 887 | $selected = (empty($this->fieldValue) ? '' : $this->fieldValue);  | 
                                                        
| 888 | - $out.= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1);  | 
                                                        |
| 888 | + $out .= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1);  | 
                                                        |
| 889 | 889 | }  | 
                                                        
| 890 | 890 |  		} elseif ($this->type == 'selectBankAccount') { | 
                                                        
| 891 | 891 |  			if (isModEnabled("bank")) { | 
                                                        
| 892 | 892 | $selected = (empty($this->fieldValue) ? '' : $this->fieldValue);  | 
                                                        
| 893 | - $out.= $this->form->select_comptes($selected, $this->confKey, 0, '', 0, '', 0, '', 1);  | 
                                                        |
| 893 | + $out .= $this->form->select_comptes($selected, $this->confKey, 0, '', 0, '', 0, '', 1);  | 
                                                        |
| 894 | 894 | }  | 
                                                        
| 895 | 895 |  		} else { | 
                                                        
| 896 | - $out.= $this->generateInputFieldText();  | 
                                                        |
| 896 | + $out .= $this->generateInputFieldText();  | 
                                                        |
| 897 | 897 | }  | 
                                                        
| 898 | 898 | |
| 899 | 899 | return $out;  | 
                                                        
@@ -919,9 +919,9 @@ discard block  | 
                                                    ||
| 919 | 919 | */  | 
                                                        
| 920 | 920 | public function generateInputFieldTextarea()  | 
                                                        
| 921 | 921 |  	{ | 
                                                        
| 922 | - $out = '<textarea class="flat" name="'.$this->confKey.'" id="'.$this->confKey.'" cols="50" rows="5" wrap="soft">' . "\n";  | 
                                                        |
| 923 | - $out.= dol_htmlentities($this->fieldValue);  | 
                                                        |
| 924 | - $out.= "</textarea>\n";  | 
                                                        |
| 922 | + $out = '<textarea class="flat" name="'.$this->confKey.'" id="'.$this->confKey.'" cols="50" rows="5" wrap="soft">'."\n";  | 
                                                        |
| 923 | + $out .= dol_htmlentities($this->fieldValue);  | 
                                                        |
| 924 | + $out .= "</textarea>\n";  | 
                                                        |
| 925 | 925 | return $out;  | 
                                                        
| 926 | 926 | }  | 
                                                        
| 927 | 927 | |
@@ -933,7 +933,7 @@ discard block  | 
                                                    ||
| 933 | 933 | public function generateInputFieldHtml()  | 
                                                        
| 934 | 934 |  	{ | 
                                                        
| 935 | 935 | global $conf;  | 
                                                        
| 936 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';  | 
                                                        |
| 936 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';  | 
                                                        |
| 937 | 937 |  		$doleditor = new DolEditor($this->confKey, $this->fieldValue, '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%'); | 
                                                        
| 938 | 938 | return $doleditor->Create(1);  | 
                                                        
| 939 | 939 | }  | 
                                                        
@@ -965,7 +965,7 @@ discard block  | 
                                                    ||
| 965 | 965 | |
| 966 | 966 | $out = '';  | 
                                                        
| 967 | 967 |  		if (preg_match('/emailtemplate:/', $this->type)) { | 
                                                        
| 968 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';  | 
                                                        |
| 968 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';  | 
                                                        |
| 969 | 969 | $formmail = new FormMail($this->db);  | 
                                                        
| 970 | 970 | |
| 971 | 971 |  			$tmp = explode(':', $this->type); | 
                                                        
@@ -975,10 +975,10 @@ discard block  | 
                                                    ||
| 975 | 975 |  				foreach ($formmail->lines_model as $modelMail) { | 
                                                        
| 976 | 976 | $moreonlabel = '';  | 
                                                        
| 977 | 977 |  					if (!empty($arrayOfMessageName[$modelMail->label])) { | 
                                                        
| 978 | -						$moreonlabel = ' <span class="opacitymedium">(' . $this->langs->trans("SeveralLangugeVariatFound") . ')</span>'; | 
                                                        |
| 978 | +						$moreonlabel = ' <span class="opacitymedium">('.$this->langs->trans("SeveralLangugeVariatFound").')</span>'; | 
                                                        |
| 979 | 979 | }  | 
                                                        
| 980 | 980 | // The 'label' is the key that is unique if we exclude the language  | 
                                                        
| 981 | -					$arrayOfMessageName[$modelMail->id] = $this->langs->trans(preg_replace('/\(|\)/', '', $modelMail->label)) . $moreonlabel; | 
                                                        |
| 981 | +					$arrayOfMessageName[$modelMail->id] = $this->langs->trans(preg_replace('/\(|\)/', '', $modelMail->label)).$moreonlabel; | 
                                                        |
| 982 | 982 | }  | 
                                                        
| 983 | 983 | }  | 
                                                        
| 984 | 984 | $out .= $this->form->selectarray($this->confKey, $arrayOfMessageName, $this->fieldValue, 'None', 0, 0, '', 0, 0, 0, '', '', 1);  | 
                                                        
@@ -998,7 +998,7 @@ discard block  | 
                                                    ||
| 998 | 998 | global $conf;  | 
                                                        
| 999 | 999 | $out = '<input required="required" type="text" class="flat" id="'.$this->confKey.'" name="'.$this->confKey.'" value="'.(GETPOST($this->confKey, 'alpha') ? GETPOST($this->confKey, 'alpha') : $this->fieldValue).'" size="40">';  | 
                                                        
| 1000 | 1000 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 1001 | -			$out.= ' '.img_picto($this->langs->trans('Generate'), 'refresh', 'id="generate_token'.$this->confKey.'" class="linkobject"'); | 
                                                        |
| 1001 | +			$out .= ' '.img_picto($this->langs->trans('Generate'), 'refresh', 'id="generate_token'.$this->confKey.'" class="linkobject"'); | 
                                                        |
| 1002 | 1002 | }  | 
                                                        
| 1003 | 1003 | |
| 1004 | 1004 | // Add button to autosuggest a key  | 
                                                        
@@ -1113,30 +1113,30 @@ discard block  | 
                                                    ||
| 1113 | 1113 |  		if ($this->type == 'title') { | 
                                                        
| 1114 | 1114 | // nothing to do  | 
                                                        
| 1115 | 1115 |  		} elseif ($this->type == 'textarea') { | 
                                                        
| 1116 | - $out.= dol_nl2br($this->fieldValue);  | 
                                                        |
| 1116 | + $out .= dol_nl2br($this->fieldValue);  | 
                                                        |
| 1117 | 1117 |  		} elseif ($this->type == 'multiselect') { | 
                                                        
| 1118 | - $out.= $this->generateOutputFieldMultiSelect();  | 
                                                        |
| 1118 | + $out .= $this->generateOutputFieldMultiSelect();  | 
                                                        |
| 1119 | 1119 |  		} elseif ($this->type == 'select') { | 
                                                        
| 1120 | - $out.= $this->generateOutputFieldSelect();  | 
                                                        |
| 1120 | + $out .= $this->generateOutputFieldSelect();  | 
                                                        |
| 1121 | 1121 |  		} elseif ($this->type == 'selectUser') { | 
                                                        
| 1122 | - $out.= $this->generateOutputFieldSelectUser();  | 
                                                        |
| 1122 | + $out .= $this->generateOutputFieldSelectUser();  | 
                                                        |
| 1123 | 1123 |  		} elseif ($this->type == 'html') { | 
                                                        
| 1124 | - $out.= $this->fieldValue;  | 
                                                        |
| 1124 | + $out .= $this->fieldValue;  | 
                                                        |
| 1125 | 1125 |  		} elseif ($this->type == 'color') { | 
                                                        
| 1126 | - $out.= $this->generateOutputFieldColor();  | 
                                                        |
| 1126 | + $out .= $this->generateOutputFieldColor();  | 
                                                        |
| 1127 | 1127 |  		} elseif ($this->type == 'yesno') { | 
                                                        
| 1128 | 1128 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 1129 | - $out.= ajax_constantonoff($this->confKey);  | 
                                                        |
| 1129 | + $out .= ajax_constantonoff($this->confKey);  | 
                                                        |
| 1130 | 1130 |  			} else { | 
                                                        
| 1131 | 1131 |  				if ($this->fieldValue == 1) { | 
                                                        
| 1132 | -					$out.= $langs->trans('yes'); | 
                                                        |
| 1132 | +					$out .= $langs->trans('yes'); | 
                                                        |
| 1133 | 1133 |  				} else { | 
                                                        
| 1134 | -					$out.= $langs->trans('no'); | 
                                                        |
| 1134 | +					$out .= $langs->trans('no'); | 
                                                        |
| 1135 | 1135 | }  | 
                                                        
| 1136 | 1136 | }  | 
                                                        
| 1137 | 1137 |  		} elseif (preg_match('/emailtemplate:/', $this->type)) { | 
                                                        
| 1138 | 1138 |  			if ($this->fieldValue > 0) { | 
                                                        
| 1139 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';  | 
                                                        |
| 1139 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';  | 
                                                        |
| 1140 | 1140 | $formmail = new FormMail($this->db);  | 
                                                        
| 1141 | 1141 | |
| 1142 | 1142 |  				$tmp = explode(':', $this->type); | 
                                                        
@@ -1145,7 +1145,7 @@ discard block  | 
                                                    ||
| 1145 | 1145 |  				if (is_numeric($template) && $template < 0) { | 
                                                        
| 1146 | 1146 | $this->setErrors($formmail->errors);  | 
                                                        
| 1147 | 1147 | }  | 
                                                        
| 1148 | - $out.= $this->langs->trans($template->label);  | 
                                                        |
| 1148 | + $out .= $this->langs->trans($template->label);  | 
                                                        |
| 1149 | 1149 | }  | 
                                                        
| 1150 | 1150 |  		} elseif (preg_match('/category:/', $this->type)) { | 
                                                        
| 1151 | 1151 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';  | 
                                                        
@@ -1157,18 +1157,18 @@ discard block  | 
                                                    ||
| 1157 | 1157 |  			$ways = $c->print_all_ways(' >> ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text | 
                                                        
| 1158 | 1158 | $toprint = array();  | 
                                                        
| 1159 | 1159 |  			foreach ($ways as $way) { | 
                                                        
| 1160 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';  | 
                                                        |
| 1160 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';  | 
                                                        |
| 1161 | 1161 | }  | 
                                                        
| 1162 | -			$out.='<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; | 
                                                        |
| 1162 | +			$out .= '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; | 
                                                        |
| 1163 | 1163 |  		} elseif (preg_match('/thirdparty_type/', $this->type)) { | 
                                                        
| 1164 | -			if ($this->fieldValue==2) { | 
                                                        |
| 1165 | -				$out.= $this->langs->trans("Prospect"); | 
                                                        |
| 1166 | -			} elseif ($this->fieldValue==3) { | 
                                                        |
| 1167 | -				$out.= $this->langs->trans("ProspectCustomer"); | 
                                                        |
| 1168 | -			} elseif ($this->fieldValue==1) { | 
                                                        |
| 1169 | -				$out.= $this->langs->trans("Customer"); | 
                                                        |
| 1170 | -			} elseif ($this->fieldValue==0) { | 
                                                        |
| 1171 | -				$out.= $this->langs->trans("NorProspectNorCustomer"); | 
                                                        |
| 1164 | +			if ($this->fieldValue == 2) { | 
                                                        |
| 1165 | +				$out .= $this->langs->trans("Prospect"); | 
                                                        |
| 1166 | +			} elseif ($this->fieldValue == 3) { | 
                                                        |
| 1167 | +				$out .= $this->langs->trans("ProspectCustomer"); | 
                                                        |
| 1168 | +			} elseif ($this->fieldValue == 1) { | 
                                                        |
| 1169 | +				$out .= $this->langs->trans("Customer"); | 
                                                        |
| 1170 | +			} elseif ($this->fieldValue == 0) { | 
                                                        |
| 1171 | +				$out .= $this->langs->trans("NorProspectNorCustomer"); | 
                                                        |
| 1172 | 1172 | }  | 
                                                        
| 1173 | 1173 |  		} elseif ($this->type == 'product') { | 
                                                        
| 1174 | 1174 | require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        
@@ -1176,7 +1176,7 @@ discard block  | 
                                                    ||
| 1176 | 1176 | $product = new Product($this->db);  | 
                                                        
| 1177 | 1177 | $resprod = $product->fetch($this->fieldValue);  | 
                                                        
| 1178 | 1178 |  			if ($resprod > 0) { | 
                                                        
| 1179 | - $out.= $product->ref;  | 
                                                        |
| 1179 | + $out .= $product->ref;  | 
                                                        |
| 1180 | 1180 |  			} elseif ($resprod < 0) { | 
                                                        
| 1181 | 1181 | $this->setErrors($product->errors);  | 
                                                        
| 1182 | 1182 | }  | 
                                                        
@@ -1186,12 +1186,12 @@ discard block  | 
                                                    ||
| 1186 | 1186 | $bankaccount = new Account($this->db);  | 
                                                        
| 1187 | 1187 | $resbank = $bankaccount->fetch($this->fieldValue);  | 
                                                        
| 1188 | 1188 |  			if ($resbank > 0) { | 
                                                        
| 1189 | - $out.= $bankaccount->label;  | 
                                                        |
| 1189 | + $out .= $bankaccount->label;  | 
                                                        |
| 1190 | 1190 |  			} elseif ($resbank < 0) { | 
                                                        
| 1191 | 1191 | $this->setErrors($bankaccount->errors);  | 
                                                        
| 1192 | 1192 | }  | 
                                                        
| 1193 | 1193 |  		} else { | 
                                                        
| 1194 | - $out.= $this->fieldValue;  | 
                                                        |
| 1194 | + $out .= $this->fieldValue;  | 
                                                        |
| 1195 | 1195 | }  | 
                                                        
| 1196 | 1196 | |
| 1197 | 1197 | return $out;  | 
                                                        
@@ -1214,7 +1214,7 @@ discard block  | 
                                                    ||
| 1214 | 1214 |  		if (!empty($TSelected)) { | 
                                                        
| 1215 | 1215 |  			foreach ($TSelected as $selected) { | 
                                                        
| 1216 | 1216 |  				if (!empty($this->fieldOptions[$selected])) { | 
                                                        
| 1217 | -					$outPut.= dolGetBadge('', $this->fieldOptions[$selected], 'info').' '; | 
                                                        |
| 1217 | +					$outPut .= dolGetBadge('', $this->fieldOptions[$selected], 'info').' '; | 
                                                        |
| 1218 | 1218 | }  | 
                                                        
| 1219 | 1219 | }  | 
                                                        
| 1220 | 1220 | }  | 
                                                        
@@ -1228,7 +1228,7 @@ discard block  | 
                                                    ||
| 1228 | 1228 | */  | 
                                                        
| 1229 | 1229 | public function generateOutputFieldColor()  | 
                                                        
| 1230 | 1230 |  	{ | 
                                                        
| 1231 | - $this->fieldAttr['disabled']=null;  | 
                                                        |
| 1231 | + $this->fieldAttr['disabled'] = null;  | 
                                                        |
| 1232 | 1232 | return $this->generateInputField();  | 
                                                        
| 1233 | 1233 | }  | 
                                                        
| 1234 | 1234 | /**  | 
                                                        
@@ -1238,7 +1238,7 @@ discard block  | 
                                                    ||
| 1238 | 1238 | */  | 
                                                        
| 1239 | 1239 | public function generateInputFieldColor()  | 
                                                        
| 1240 | 1240 |  	{ | 
                                                        
| 1241 | - $this->fieldAttr['type']= 'color';  | 
                                                        |
| 1241 | + $this->fieldAttr['type'] = 'color';  | 
                                                        |
| 1242 | 1242 | return $this->generateInputFieldText();  | 
                                                        
| 1243 | 1243 | }  | 
                                                        
| 1244 | 1244 | |
@@ -1267,7 +1267,7 @@ discard block  | 
                                                    ||
| 1267 | 1267 | $outPut = '';  | 
                                                        
| 1268 | 1268 | $user = new User($this->db);  | 
                                                        
| 1269 | 1269 | $user->fetch($this->fieldValue);  | 
                                                        
| 1270 | - $outPut = $user->firstname . " " . $user->lastname;  | 
                                                        |
| 1270 | + $outPut = $user->firstname." ".$user->lastname;  | 
                                                        |
| 1271 | 1271 | return $outPut;  | 
                                                        
| 1272 | 1272 | }  | 
                                                        
| 1273 | 1273 | |
@@ -89,9 +89,9 @@ discard block  | 
                                                    ||
| 89 | 89 | */  | 
                                                        
| 90 | 90 | public $revenuestamp;  | 
                                                        
| 91 | 91 | |
| 92 | - public $totalpaid; // duplicate with sumpayed  | 
                                                        |
| 93 | - public $totaldeposits; // duplicate with sumdeposit  | 
                                                        |
| 94 | - public $totalcreditnotes; // duplicate with sumcreditnote  | 
                                                        |
| 92 | + public $totalpaid; // duplicate with sumpayed  | 
                                                        |
| 93 | + public $totaldeposits; // duplicate with sumdeposit  | 
                                                        |
| 94 | + public $totalcreditnotes; // duplicate with sumcreditnote  | 
                                                        |
| 95 | 95 | |
| 96 | 96 | public $sumpayed;  | 
                                                        
| 97 | 97 | public $sumpayed_multicurrency;  | 
                                                        
@@ -456,7 +456,7 @@ discard block  | 
                                                    ||
| 456 | 456 | $sharedentity = 'facture_fourn';  | 
                                                        
| 457 | 457 | }  | 
                                                        
| 458 | 458 | |
| 459 | - $sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3 . $field4;  | 
                                                        |
| 459 | + $sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3.$field4;  | 
                                                        |
| 460 | 460 | $sql .= " FROM ".$this->db->prefix().$table." as pf, ".$this->db->prefix().$table2." as p, ".$this->db->prefix()."c_paiement as t";  | 
                                                        
| 461 | 461 | $sql .= " WHERE pf.".$field." = ".((int) $this->id);  | 
                                                        
| 462 | 462 | $sql .= " AND pf.".$field2." = p.rowid";  | 
                                                        
@@ -697,12 +697,12 @@ discard block  | 
                                                    ||
| 697 | 697 |  	{ | 
                                                        
| 698 | 698 | $subtypeLabel = '';  | 
                                                        
| 699 | 699 |  		if ($table === 'facture' || $table === 'facture_fourn') { | 
                                                        
| 700 | - $sql = "SELECT s.label FROM " . $this->db->prefix() . $table . " AS f";  | 
                                                        |
| 701 | - $sql .= " INNER JOIN " . $this->db->prefix() . "c_invoice_subtype AS s ON f.subtype = s.rowid";  | 
                                                        |
| 700 | + $sql = "SELECT s.label FROM ".$this->db->prefix().$table." AS f";  | 
                                                        |
| 701 | + $sql .= " INNER JOIN ".$this->db->prefix()."c_invoice_subtype AS s ON f.subtype = s.rowid";  | 
                                                        |
| 702 | 702 | $sql .= " WHERE f.ref = '".$this->db->escape($this->ref)."'";  | 
                                                        
| 703 | 703 |  		} elseif ($table === 'facture_rec' || $table === 'facture_fourn_rec') { | 
                                                        
| 704 | - $sql = "SELECT s.label FROM " . $this->db->prefix() . $table . " AS f";  | 
                                                        |
| 705 | - $sql .= " INNER JOIN " . $this->db->prefix() . "c_invoice_subtype AS s ON f.subtype = s.rowid";  | 
                                                        |
| 704 | + $sql = "SELECT s.label FROM ".$this->db->prefix().$table." AS f";  | 
                                                        |
| 705 | + $sql .= " INNER JOIN ".$this->db->prefix()."c_invoice_subtype AS s ON f.subtype = s.rowid";  | 
                                                        |
| 706 | 706 | $sql .= " WHERE f.titre = '".$this->db->escape($this->title)."'";  | 
                                                        
| 707 | 707 |  		} else { | 
                                                        
| 708 | 708 | return -1;  | 
                                                        
@@ -734,10 +734,10 @@ discard block  | 
                                                    ||
| 734 | 734 | $effs = array();  | 
                                                        
| 735 | 735 | |
| 736 | 736 | $sql = "SELECT rowid, code, label as label";  | 
                                                        
| 737 | - $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';  | 
                                                        |
| 737 | + $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';  | 
                                                        |
| 738 | 738 |  		$sql .= " WHERE active = 1 AND fk_country = ".((int) $mysoc->country_id)." AND entity IN(".getEntity('c_invoice_subtype').")"; | 
                                                        
| 739 | 739 | $sql .= " ORDER by rowid, code";  | 
                                                        
| 740 | - dol_syslog(get_class($this) . '::getArrayOfInvoiceSubtypes', LOG_DEBUG);  | 
                                                        |
| 740 | + dol_syslog(get_class($this).'::getArrayOfInvoiceSubtypes', LOG_DEBUG);  | 
                                                        |
| 741 | 741 | $resql = $this->db->query($sql);  | 
                                                        
| 742 | 742 |  		if ($resql) { | 
                                                        
| 743 | 743 | $num = $this->db->num_rows($resql);  | 
                                                        
@@ -1129,7 +1129,7 @@ discard block  | 
                                                    ||
| 1129 | 1129 |  		if ($this->status > self::STATUS_DRAFT && $this->paye == 0) { | 
                                                        
| 1130 | 1130 | // Get the default payment mode for BAN payment of the third party  | 
                                                        
| 1131 | 1131 | require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';  | 
                                                        
| 1132 | - $bac = new CompanyBankAccount($this->db); // table societe_rib  | 
                                                        |
| 1132 | + $bac = new CompanyBankAccount($this->db); // table societe_rib  | 
                                                        |
| 1133 | 1133 | $result = $bac->fetch(0, $this->socid, 1, 'ban');  | 
                                                        
| 1134 | 1134 |  			if ($result <= 0 || empty($bac->id)) { | 
                                                        
| 1135 | 1135 |  				$this->error = $langs->trans("ThirdpartyHasNoDefaultBanAccount"); | 
                                                        
@@ -1143,16 +1143,16 @@ discard block  | 
                                                    ||
| 1143 | 1143 | $sql .= " FROM ".$this->db->prefix()."prelevement_demande";  | 
                                                        
| 1144 | 1144 | $sql .= " WHERE rowid = ".((int) $did);  | 
                                                        
| 1145 | 1145 |  			if ($type != 'bank-transfer' && $type != 'credit-transfer') { | 
                                                        
| 1146 | - $sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one  | 
                                                        |
| 1146 | + $sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one  | 
                                                        |
| 1147 | 1147 | }  | 
                                                        
| 1148 | 1148 |  			if ($type != 'direct-debit') { | 
                                                        
| 1149 | 1149 |  				if ($$sourcetype == 'salary') { | 
                                                        
| 1150 | - $sql .= " AND fk_salary = ".((int) $this->id); // Add a protection to not pay another salary than current one  | 
                                                        |
| 1150 | + $sql .= " AND fk_salary = ".((int) $this->id); // Add a protection to not pay another salary than current one  | 
                                                        |
| 1151 | 1151 |  				} else { | 
                                                        
| 1152 | - $sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one  | 
                                                        |
| 1152 | + $sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one  | 
                                                        |
| 1153 | 1153 | }  | 
                                                        
| 1154 | 1154 | }  | 
                                                        
| 1155 | - $sql .= " AND traite = 0"; // To not process payment request that were already converted into a direct debit or credit transfer order (Note: fk_prelevement_bons is also empty when traite = 0)  | 
                                                        |
| 1155 | + $sql .= " AND traite = 0"; // To not process payment request that were already converted into a direct debit or credit transfer order (Note: fk_prelevement_bons is also empty when traite = 0)  | 
                                                        |
| 1156 | 1156 | |
| 1157 | 1157 | dol_syslog(get_class($this)."::makeStripeSepaRequest load requests to process", LOG_DEBUG);  | 
                                                        
| 1158 | 1158 | $resql = $this->db->query($sql);  | 
                                                        
@@ -1168,7 +1168,7 @@ discard block  | 
                                                    ||
| 1168 | 1168 | |
| 1169 | 1169 |  				if (is_numeric($amount) && $amount != 0) { | 
                                                        
| 1170 | 1170 | require_once DOL_DOCUMENT_ROOT.'/societe/class/companypaymentmode.class.php';  | 
                                                        
| 1171 | - $companypaymentmode = new CompanyPaymentMode($this->db); // table societe_rib  | 
                                                        |
| 1171 | + $companypaymentmode = new CompanyPaymentMode($this->db); // table societe_rib  | 
                                                        |
| 1172 | 1172 | $companypaymentmode->fetch($bac->id);  | 
                                                        
| 1173 | 1173 | |
| 1174 | 1174 | $this->stripechargedone = 0;  | 
                                                        
@@ -1178,11 +1178,11 @@ discard block  | 
                                                    ||
| 1178 | 1178 | |
| 1179 | 1179 | $currency = $conf->currency;  | 
                                                        
| 1180 | 1180 | |
| 1181 | - $errorforinvoice = 0; // We reset the $errorforinvoice at each invoice loop  | 
                                                        |
| 1181 | + $errorforinvoice = 0; // We reset the $errorforinvoice at each invoice loop  | 
                                                        |
| 1182 | 1182 | |
| 1183 | 1183 | $this->fetch_thirdparty();  | 
                                                        
| 1184 | 1184 | |
| 1185 | -					dol_syslog("makeStripeSepaRequest Process payment request amount=".$amount." thirdparty_id=" . $this->thirdparty->id . ", thirdparty_name=" . $this->thirdparty->name . " ban id=" . $bac->id, LOG_DEBUG); | 
                                                        |
| 1185 | +					dol_syslog("makeStripeSepaRequest Process payment request amount=".$amount." thirdparty_id=".$this->thirdparty->id.", thirdparty_name=".$this->thirdparty->name." ban id=".$bac->id, LOG_DEBUG); | 
                                                        |
| 1186 | 1186 | |
| 1187 | 1187 | //$alreadypayed = $this->getSommePaiement();  | 
                                                        
| 1188 | 1188 | //$amount_credit_notes_included = $this->getSumCreditNotesUsed();  | 
                                                        
@@ -1197,7 +1197,7 @@ discard block  | 
                                                    ||
| 1197 | 1197 | $amountstripe = $amountstripe * 100;  | 
                                                        
| 1198 | 1198 | }  | 
                                                        
| 1199 | 1199 | |
| 1200 | -					$fk_bank_account = getDolGlobalInt('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS');		// Bank account used for SEPA direct debit or credit transfer. Must be the Stripe account in Dolibarr. | 
                                                        |
| 1200 | +					$fk_bank_account = getDolGlobalInt('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'); // Bank account used for SEPA direct debit or credit transfer. Must be the Stripe account in Dolibarr. | 
                                                        |
| 1201 | 1201 |  					if (!($fk_bank_account > 0)) { | 
                                                        
| 1202 | 1202 | $error++;  | 
                                                        
| 1203 | 1203 | $errorforinvoice++;  | 
                                                        
@@ -1253,44 +1253,44 @@ discard block  | 
                                                    ||
| 1253 | 1253 | }  | 
                                                        
| 1254 | 1254 | |
| 1255 | 1255 | //var_dump($companypaymentmode);  | 
                                                        
| 1256 | -								dol_syslog("makeStripeSepaRequest We will try to pay with companypaymentmodeid=" . $companypaymentmode->id . " stripe_card_ref=" . $companypaymentmode->stripe_card_ref . " mode=" . $companypaymentmode->status, LOG_DEBUG); | 
                                                        |
| 1256 | +								dol_syslog("makeStripeSepaRequest We will try to pay with companypaymentmodeid=".$companypaymentmode->id." stripe_card_ref=".$companypaymentmode->stripe_card_ref." mode=".$companypaymentmode->status, LOG_DEBUG); | 
                                                        |
| 1257 | 1257 | |
| 1258 | 1258 | $thirdparty = new Societe($this->db);  | 
                                                        
| 1259 | 1259 | $resultthirdparty = $thirdparty->fetch($this->socid);  | 
                                                        
| 1260 | 1260 | |
| 1261 | - include_once DOL_DOCUMENT_ROOT . '/stripe/class/stripe.class.php'; // This include the include of htdocs/stripe/config.php  | 
                                                        |
| 1261 | + include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; // This include the include of htdocs/stripe/config.php  | 
                                                        |
| 1262 | 1262 | // So it inits or erases the $stripearrayofkeysbyenv  | 
                                                        
| 1263 | 1263 | $stripe = new Stripe($this->db);  | 
                                                        
| 1264 | 1264 | |
| 1265 | 1265 |  								if (empty($savstripearrayofkeysbyenv)) { | 
                                                        
| 1266 | 1266 | $savstripearrayofkeysbyenv = $stripearrayofkeysbyenv;  | 
                                                        
| 1267 | 1267 | }  | 
                                                        
| 1268 | -								dol_syslog("makeStripeSepaRequest Current Stripe environment is " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key']); | 
                                                        |
| 1268 | +								dol_syslog("makeStripeSepaRequest Current Stripe environment is ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key']); | 
                                                        |
| 1269 | 1269 |  								dol_syslog("makeStripeSepaRequest Current Saved Stripe environment is ".$savstripearrayofkeysbyenv[$servicestatus]['publishable_key']); | 
                                                        
| 1270 | 1270 | |
| 1271 | 1271 | $foundalternativestripeaccount = '';  | 
                                                        
| 1272 | 1272 | |
| 1273 | 1273 | // Force stripe to another value (by default this value is empty)  | 
                                                        
| 1274 | -								if (! empty($forcestripe)) { | 
                                                        |
| 1274 | +								if (!empty($forcestripe)) { | 
                                                        |
| 1275 | 1275 |  									dol_syslog("makeStripeSepaRequest A dedicated stripe account was forced, so we switch to it."); | 
                                                        
| 1276 | 1276 | |
| 1277 | 1277 |  									$tmparray = explode('@', $forcestripe); | 
                                                        
| 1278 | -									if (! empty($tmparray[1])) { | 
                                                        |
| 1278 | +									if (!empty($tmparray[1])) { | 
                                                        |
| 1279 | 1279 |  										$tmparray2 = explode(':', $tmparray[1]); | 
                                                        
| 1280 | -										if (! empty($tmparray2[1])) { | 
                                                        |
| 1280 | +										if (!empty($tmparray2[1])) { | 
                                                        |
| 1281 | 1281 | $stripearrayofkeysbyenv[$servicestatus]["publishable_key"] = $tmparray2[0];  | 
                                                        
| 1282 | 1282 | $stripearrayofkeysbyenv[$servicestatus]["secret_key"] = $tmparray2[1];  | 
                                                        
| 1283 | 1283 | |
| 1284 | 1284 | $stripearrayofkeys = $stripearrayofkeysbyenv[$servicestatus];  | 
                                                        
| 1285 | 1285 | \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);  | 
                                                        
| 1286 | 1286 | |
| 1287 | - $foundalternativestripeaccount = $tmparray[0]; // Store the customer id  | 
                                                        |
| 1287 | + $foundalternativestripeaccount = $tmparray[0]; // Store the customer id  | 
                                                        |
| 1288 | 1288 | |
| 1289 | 1289 |  											dol_syslog("makeStripeSepaRequest We use now customer=".$foundalternativestripeaccount." publishable_key=".$stripearrayofkeys['publishable_key'], LOG_DEBUG); | 
                                                        
| 1290 | 1290 | }  | 
                                                        
| 1291 | 1291 | }  | 
                                                        
| 1292 | 1292 | |
| 1293 | -									if (! $foundalternativestripeaccount) { | 
                                                        |
| 1293 | +									if (!$foundalternativestripeaccount) { | 
                                                        |
| 1294 | 1294 | $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;  | 
                                                        
| 1295 | 1295 | |
| 1296 | 1296 | $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];  | 
                                                        
@@ -1305,7 +1305,7 @@ discard block  | 
                                                    ||
| 1305 | 1305 |  									dol_syslog("makeStripeSepaRequest No dedicated Stripe Account requested, so we use global one, so ".$stripearrayofkeys['publishable_key'], LOG_DEBUG); | 
                                                        
| 1306 | 1306 | }  | 
                                                        
| 1307 | 1307 | |
| 1308 | - $stripeacc = $stripe->getStripeAccount($service, $this->socid); // Get Stripe OAuth connect account if it exists (no network access here)  | 
                                                        |
| 1308 | + $stripeacc = $stripe->getStripeAccount($service, $this->socid); // Get Stripe OAuth connect account if it exists (no network access here)  | 
                                                        |
| 1309 | 1309 | |
| 1310 | 1310 |  								if ($foundalternativestripeaccount) { | 
                                                        
| 1311 | 1311 |  									if (empty($stripeacc)) {				// If the Stripe connect account not set, we use common API usage | 
                                                        
@@ -1315,7 +1315,7 @@ discard block  | 
                                                    ||
| 1315 | 1315 | }  | 
                                                        
| 1316 | 1316 |  								} else { | 
                                                        
| 1317 | 1317 | $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0);  | 
                                                        
| 1318 | -									if (empty($customer) && ! empty($stripe->error)) { | 
                                                        |
| 1318 | +									if (empty($customer) && !empty($stripe->error)) { | 
                                                        |
| 1319 | 1319 | $this->errors[] = $stripe->error;  | 
                                                        
| 1320 | 1320 | }  | 
                                                        
| 1321 | 1321 |  									/*if (!empty($customer) && empty($customer->sources)) { | 
                                                        
@@ -1342,15 +1342,15 @@ discard block  | 
                                                    ||
| 1342 | 1342 | }  | 
                                                        
| 1343 | 1343 | |
| 1344 | 1344 |  										if ($stripecard) {  // Can be src_... (for sepa) or pm_... (new card mode). Note that card_... (old card mode) should not happen here. | 
                                                        
| 1345 | - $FULLTAG = 'DID='.$did.'-INV=' . $this->id . '-CUS=' . $thirdparty->id;  | 
                                                        |
| 1346 | - $description = 'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG . ' did='.$did.' ref=' . $this->ref;  | 
                                                        |
| 1345 | + $FULLTAG = 'DID='.$did.'-INV='.$this->id.'-CUS='.$thirdparty->id;  | 
                                                        |
| 1346 | + $description = 'Stripe payment from makeStripeSepaRequest: '.$FULLTAG.' did='.$did.' ref='.$this->ref;  | 
                                                        |
| 1347 | 1347 | |
| 1348 | 1348 | $stripefailurecode = '';  | 
                                                        
| 1349 | 1349 | $stripefailuremessage = '';  | 
                                                        
| 1350 | 1350 | $stripefailuredeclinecode = '';  | 
                                                        
| 1351 | 1351 | |
| 1352 | 1352 | // Using new SCA method  | 
                                                        
| 1353 | -											dol_syslog("* Create payment on SEPA " . $stripecard->id . ", amounttopay=" . $amounttopay . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG); | 
                                                        |
| 1353 | +											dol_syslog("* Create payment on SEPA ".$stripecard->id.", amounttopay=".$amounttopay.", amountstripe=".$amountstripe.", FULLTAG=".$FULLTAG, LOG_DEBUG); | 
                                                        |
| 1354 | 1354 | |
| 1355 | 1355 | // Create payment intent and charge payment (confirmnow = true)  | 
                                                        
| 1356 | 1356 | $paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1, 1, $did);  | 
                                                        
@@ -1371,7 +1371,7 @@ discard block  | 
                                                    ||
| 1371 | 1371 | $charge->failure_message = $stripe->error;  | 
                                                        
| 1372 | 1372 | $charge->failure_declinecode = $stripe->declinecode;  | 
                                                        
| 1373 | 1373 | $stripefailurecode = $stripe->code;  | 
                                                        
| 1374 | - $stripefailuremessage = 'Action required. Contact the support at ';// . $conf->global->SELLYOURSAAS_MAIN_EMAIL;  | 
                                                        |
| 1374 | + $stripefailuremessage = 'Action required. Contact the support at '; // . $conf->global->SELLYOURSAAS_MAIN_EMAIL;  | 
                                                        |
| 1375 | 1375 | $stripefailuredeclinecode = $stripe->declinecode;  | 
                                                        
| 1376 | 1376 |  											} else { | 
                                                        
| 1377 | 1377 | dol_syslog(var_export($paymentintent, true), LOG_DEBUG);  | 
                                                        
@@ -1392,7 +1392,7 @@ discard block  | 
                                                    ||
| 1392 | 1392 | |
| 1393 | 1393 |  											// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) | 
                                                        
| 1394 | 1394 |  											if (empty($charge) || $charge->status == 'failed') { | 
                                                        
| 1395 | -												dol_syslog('Failed to charge payment mode ' . $stripecard->id . ' stripefailurecode=' . $stripefailurecode . ' stripefailuremessage=' . $stripefailuremessage . ' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING); | 
                                                        |
| 1395 | +												dol_syslog('Failed to charge payment mode '.$stripecard->id.' stripefailurecode='.$stripefailurecode.' stripefailuremessage='.$stripefailuremessage.' stripefailuredeclinecode='.$stripefailuredeclinecode, LOG_WARNING); | 
                                                        |
| 1396 | 1396 | |
| 1397 | 1397 | // Save a stripe payment was in error  | 
                                                        
| 1398 | 1398 | $this->stripechargeerror++;  | 
                                                        
@@ -1405,8 +1405,8 @@ discard block  | 
                                                    ||
| 1405 | 1405 |  														$errauthenticationmessage = $langs->trans("ErrSCAAuthentication"); | 
                                                        
| 1406 | 1406 | $errmsg = $errauthenticationmessage;  | 
                                                        
| 1407 | 1407 |  													} elseif (in_array($stripefailuredeclinecode, ['insufficient_funds', 'generic_decline'])) { | 
                                                        
| 1408 | - $errmsg .= ': ' . $charge->failure_code;  | 
                                                        |
| 1409 | - $errmsg .= ($charge->failure_message ? ' - ' : '') . ' ' . $charge->failure_message;  | 
                                                        |
| 1408 | + $errmsg .= ': '.$charge->failure_code;  | 
                                                        |
| 1409 | + $errmsg .= ($charge->failure_message ? ' - ' : '').' '.$charge->failure_message;  | 
                                                        |
| 1410 | 1410 |  														if (empty($stripefailurecode)) { | 
                                                        
| 1411 | 1411 | $stripefailurecode = $charge->failure_code;  | 
                                                        
| 1412 | 1412 | }  | 
                                                        
@@ -1414,8 +1414,8 @@ discard block  | 
                                                    ||
| 1414 | 1414 | $stripefailuremessage = $charge->failure_message;  | 
                                                        
| 1415 | 1415 | }  | 
                                                        
| 1416 | 1416 |  													} else { | 
                                                        
| 1417 | - $errmsg .= ': failure_code=' . $charge->failure_code;  | 
                                                        |
| 1418 | - $errmsg .= ($charge->failure_message ? ' - ' : '') . ' failure_message=' . $charge->failure_message;  | 
                                                        |
| 1417 | + $errmsg .= ': failure_code='.$charge->failure_code;  | 
                                                        |
| 1418 | + $errmsg .= ($charge->failure_message ? ' - ' : '').' failure_message='.$charge->failure_message;  | 
                                                        |
| 1419 | 1419 |  														if (empty($stripefailurecode)) { | 
                                                        
| 1420 | 1420 | $stripefailurecode = $charge->failure_code;  | 
                                                        
| 1421 | 1421 | }  | 
                                                        
@@ -1424,24 +1424,24 @@ discard block  | 
                                                    ||
| 1424 | 1424 | }  | 
                                                        
| 1425 | 1425 | }  | 
                                                        
| 1426 | 1426 |  												} else { | 
                                                        
| 1427 | - $errmsg .= ': ' . $stripefailurecode . ' - ' . $stripefailuremessage;  | 
                                                        |
| 1428 | - $errmsg .= ($stripefailuredeclinecode ? ' - ' . $stripefailuredeclinecode : '');  | 
                                                        |
| 1427 | + $errmsg .= ': '.$stripefailurecode.' - '.$stripefailuremessage;  | 
                                                        |
| 1428 | + $errmsg .= ($stripefailuredeclinecode ? ' - '.$stripefailuredeclinecode : '');  | 
                                                        |
| 1429 | 1429 | }  | 
                                                        
| 1430 | 1430 | |
| 1431 | - $description = 'Stripe payment ERROR from makeStripeSepaRequest: ' . $FULLTAG;  | 
                                                        |
| 1432 | -												$postactionmessages[] = $errmsg . ' (' . $stripearrayofkeys['publishable_key'] . ')'; | 
                                                        |
| 1431 | + $description = 'Stripe payment ERROR from makeStripeSepaRequest: '.$FULLTAG;  | 
                                                        |
| 1432 | +												$postactionmessages[] = $errmsg.' ('.$stripearrayofkeys['publishable_key'].')'; | 
                                                        |
| 1433 | 1433 | $this->errors[] = $errmsg;  | 
                                                        
| 1434 | 1434 |  											} else { | 
                                                        
| 1435 | 1435 |  												dol_syslog('Successfuly request '.$type.' '.$stripecard->id); | 
                                                        
| 1436 | 1436 | |
| 1437 | -												$postactionmessages[] = 'Success to request '.$type.' (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')'; | 
                                                        |
| 1437 | +												$postactionmessages[] = 'Success to request '.$type.' ('.$charge->id.' with '.$stripearrayofkeys['publishable_key'].')'; | 
                                                        |
| 1438 | 1438 | |
| 1439 | 1439 | // Save a stripe payment was done in real life so later we will be able to force a commit on recorded payments  | 
                                                        
| 1440 | 1440 | // even if in batch mode (method doTakePaymentStripe), we will always make all action in one transaction with a forced commit.  | 
                                                        
| 1441 | 1441 | $this->stripechargedone++;  | 
                                                        
| 1442 | 1442 | |
| 1443 | 1443 | // Default description used for label of event. Will be overwrite by another value later.  | 
                                                        
| 1444 | -												$description = 'Stripe payment request OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG; | 
                                                        |
| 1444 | +												$description = 'Stripe payment request OK ('.$charge->id.') from makeStripeSepaRequest: '.$FULLTAG; | 
                                                        |
| 1445 | 1445 | }  | 
                                                        
| 1446 | 1446 | |
| 1447 | 1447 | $object = $this;  | 
                                                        
@@ -1450,8 +1450,8 @@ discard block  | 
                                                    ||
| 1450 | 1450 |  											if (empty($charge) || $charge->status == 'failed') { | 
                                                        
| 1451 | 1451 | $actioncode = 'PAYMENT_STRIPE_KO';  | 
                                                        
| 1452 | 1452 | $extraparams = $stripefailurecode;  | 
                                                        
| 1453 | - $extraparams .= (($extraparams && $stripefailuremessage) ? ' - ' : '') . $stripefailuremessage;  | 
                                                        |
| 1454 | - $extraparams .= (($extraparams && $stripefailuredeclinecode) ? ' - ' : '') . $stripefailuredeclinecode;  | 
                                                        |
| 1453 | + $extraparams .= (($extraparams && $stripefailuremessage) ? ' - ' : '').$stripefailuremessage;  | 
                                                        |
| 1454 | + $extraparams .= (($extraparams && $stripefailuredeclinecode) ? ' - ' : '').$stripefailuredeclinecode;  | 
                                                        |
| 1455 | 1455 |  											} else { | 
                                                        
| 1456 | 1456 | $actioncode = 'PAYMENT_STRIPE_OK';  | 
                                                        
| 1457 | 1457 | $extraparams = '';  | 
                                                        
@@ -1459,13 +1459,13 @@ discard block  | 
                                                    ||
| 1459 | 1459 |  										} else { | 
                                                        
| 1460 | 1460 | $error++;  | 
                                                        
| 1461 | 1461 | $errorforinvoice++;  | 
                                                        
| 1462 | -											dol_syslog("No ban payment method found for this stripe customer " . $customer->id, LOG_WARNING); | 
                                                        |
| 1463 | - $this->errors[] = 'Failed to get direct debit payment method for stripe customer = ' . $customer->id;  | 
                                                        |
| 1462 | +											dol_syslog("No ban payment method found for this stripe customer ".$customer->id, LOG_WARNING); | 
                                                        |
| 1463 | + $this->errors[] = 'Failed to get direct debit payment method for stripe customer = '.$customer->id;  | 
                                                        |
| 1464 | 1464 | |
| 1465 | 1465 | $description = 'Failed to find or use the payment mode - no ban defined for the thirdparty account';  | 
                                                        
| 1466 | 1466 | $stripefailurecode = 'BADPAYMENTMODE';  | 
                                                        
| 1467 | 1467 | $stripefailuremessage = 'Failed to find or use the payment mode - no ban defined for the thirdparty account';  | 
                                                        
| 1468 | -											$postactionmessages[] = $description . ' (' . $stripearrayofkeys['publishable_key'] . ')'; | 
                                                        |
| 1468 | +											$postactionmessages[] = $description.' ('.$stripearrayofkeys['publishable_key'].')'; | 
                                                        |
| 1469 | 1469 | |
| 1470 | 1470 | $object = $this;  | 
                                                        
| 1471 | 1471 | |
@@ -1485,11 +1485,11 @@ discard block  | 
                                                    ||
| 1485 | 1485 | }  | 
                                                        
| 1486 | 1486 |  								} else {	// Else of the   if ($resultthirdparty > 0 && ! empty($customer)) { | 
                                                        
| 1487 | 1487 |  									if ($resultthirdparty <= 0) { | 
                                                        
| 1488 | -										dol_syslog('SellYourSaasUtils Failed to load customer for thirdparty_id = ' . $thirdparty->id, LOG_WARNING); | 
                                                        |
| 1489 | - $this->errors[] = 'Failed to load Stripe account for thirdparty_id = ' . $thirdparty->id;  | 
                                                        |
| 1488 | +										dol_syslog('SellYourSaasUtils Failed to load customer for thirdparty_id = '.$thirdparty->id, LOG_WARNING); | 
                                                        |
| 1489 | + $this->errors[] = 'Failed to load Stripe account for thirdparty_id = '.$thirdparty->id;  | 
                                                        |
| 1490 | 1490 |  									} else { // $customer stripe not found | 
                                                        
| 1491 | -										dol_syslog('SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'], LOG_WARNING); | 
                                                        |
| 1492 | - $this->errors[] = 'Failed to get Stripe account id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'];  | 
                                                        |
| 1491 | +										dol_syslog('SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = '.$thirdparty->id." in mode ".$servicestatus." in Stripe env ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key'], LOG_WARNING); | 
                                                        |
| 1492 | + $this->errors[] = 'Failed to get Stripe account id for thirdparty_id = '.$thirdparty->id." in mode ".$servicestatus." in Stripe env ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key'];  | 
                                                        |
| 1493 | 1493 | }  | 
                                                        
| 1494 | 1494 | $error++;  | 
                                                        
| 1495 | 1495 | $errorforinvoice++;  | 
                                                        
@@ -1506,24 +1506,24 @@ discard block  | 
                                                    ||
| 1506 | 1506 | }  | 
                                                        
| 1507 | 1507 | |
| 1508 | 1508 |  								if ($description) { | 
                                                        
| 1509 | -									dol_syslog("* Record event for credit transfer or direct debit request result - " . $description); | 
                                                        |
| 1509 | +									dol_syslog("* Record event for credit transfer or direct debit request result - ".$description); | 
                                                        |
| 1510 | 1510 | require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';  | 
                                                        
| 1511 | 1511 | |
| 1512 | 1512 | // Insert record of payment (success or error)  | 
                                                        
| 1513 | 1513 | $actioncomm = new ActionComm($this->db);  | 
                                                        
| 1514 | 1514 | |
| 1515 | -									$actioncomm->type_code = 'AC_OTH_AUTO';		// Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) | 
                                                        |
| 1516 | - $actioncomm->code = 'AC_' . $actioncode;  | 
                                                        |
| 1515 | +									$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) | 
                                                        |
| 1516 | + $actioncomm->code = 'AC_'.$actioncode;  | 
                                                        |
| 1517 | 1517 | $actioncomm->label = $description;  | 
                                                        
| 1518 | 1518 |  									$actioncomm->note_private = join(",\n", $postactionmessages); | 
                                                        
| 1519 | 1519 | $actioncomm->fk_project = $this->fk_project;  | 
                                                        
| 1520 | 1520 | $actioncomm->datep = $now;  | 
                                                        
| 1521 | 1521 | $actioncomm->datef = $now;  | 
                                                        
| 1522 | - $actioncomm->percentage = -1; // Not applicable  | 
                                                        |
| 1522 | + $actioncomm->percentage = -1; // Not applicable  | 
                                                        |
| 1523 | 1523 | $actioncomm->socid = $thirdparty->id;  | 
                                                        
| 1524 | 1524 | $actioncomm->contactid = 0;  | 
                                                        
| 1525 | - $actioncomm->authorid = $user->id; // User saving action  | 
                                                        |
| 1526 | - $actioncomm->userownerid = $user->id; // Owner of action  | 
                                                        |
| 1525 | + $actioncomm->authorid = $user->id; // User saving action  | 
                                                        |
| 1526 | + $actioncomm->userownerid = $user->id; // Owner of action  | 
                                                        |
| 1527 | 1527 | // Fields when action is a real email (content is already into note)  | 
                                                        
| 1528 | 1528 | /*$actioncomm->email_msgid = $object->email_msgid;  | 
                                                        
| 1529 | 1529 | $actioncomm->email_from = $object->email_from;  | 
                                                        
@@ -1545,14 +1545,14 @@ discard block  | 
                                                    ||
| 1545 | 1545 |  							} catch (Exception $e) { | 
                                                        
| 1546 | 1546 | $error++;  | 
                                                        
| 1547 | 1547 | $errorforinvoice++;  | 
                                                        
| 1548 | -								dol_syslog('Error ' . $e->getMessage(), LOG_ERR); | 
                                                        |
| 1549 | - $this->errors[] = 'Error ' . $e->getMessage();  | 
                                                        |
| 1548 | +								dol_syslog('Error '.$e->getMessage(), LOG_ERR); | 
                                                        |
| 1549 | + $this->errors[] = 'Error '.$e->getMessage();  | 
                                                        |
| 1550 | 1550 | }  | 
                                                        
| 1551 | 1551 |  						} else {	// If remain to pay is null | 
                                                        
| 1552 | 1552 | $error++;  | 
                                                        
| 1553 | 1553 | $errorforinvoice++;  | 
                                                        
| 1554 | -							dol_syslog("Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?", LOG_WARNING); | 
                                                        |
| 1555 | - $this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?";  | 
                                                        |
| 1554 | +							dol_syslog("Remain to pay is null for the invoice ".$this->id." ".$this->ref.". Why is the invoice not classified 'Paid' ?", LOG_WARNING); | 
                                                        |
| 1555 | + $this->errors[] = "Remain to pay is null for the invoice ".$this->id." ".$this->ref.". Why is the invoice not classified 'Paid' ?";  | 
                                                        |
| 1556 | 1556 | }  | 
                                                        
| 1557 | 1557 | }  | 
                                                        
| 1558 | 1558 | |
@@ -1692,10 +1692,10 @@ discard block  | 
                                                    ||
| 1692 | 1692 |  		$s .= pack('C1', 3).pack('C1', strlen($datestring)).$datestring; | 
                                                        
| 1693 | 1693 |  		$s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring; | 
                                                        
| 1694 | 1694 |  		$s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring; | 
                                                        
| 1695 | - $s .= ''; // Hash of xml invoice  | 
                                                        |
| 1696 | - $s .= ''; // ecda signature  | 
                                                        |
| 1697 | - $s .= ''; // ecda public key  | 
                                                        |
| 1698 | - $s .= ''; // ecda signature of public key stamp  | 
                                                        |
| 1695 | + $s .= ''; // Hash of xml invoice  | 
                                                        |
| 1696 | + $s .= ''; // ecda signature  | 
                                                        |
| 1697 | + $s .= ''; // ecda public key  | 
                                                        |
| 1698 | + $s .= ''; // ecda signature of public key stamp  | 
                                                        |
| 1699 | 1699 | |
| 1700 | 1700 | $s = base64_encode($s);  | 
                                                        
| 1701 | 1701 | |
@@ -1763,8 +1763,8 @@ discard block  | 
                                                    ||
| 1763 | 1763 | $s .= "S\n";  | 
                                                        
| 1764 | 1764 | $s .= dol_trunc($bankaccount->proprio, 70, 'right', 'UTF-8', 1)."\n";  | 
                                                        
| 1765 | 1765 |  			$addresslinearray = explode("\n", $bankaccount->owner_address); | 
                                                        
| 1766 | - $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1  | 
                                                        |
| 1767 | - $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2  | 
                                                        |
| 1766 | + $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1  | 
                                                        |
| 1767 | + $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2  | 
                                                        |
| 1768 | 1768 | /*$s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n";  | 
                                                        
| 1769 | 1769 | $s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n";  | 
                                                        
| 1770 | 1770 | $s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n";*/  | 
                                                        
@@ -1772,8 +1772,8 @@ discard block  | 
                                                    ||
| 1772 | 1772 | $s .= "S\n";  | 
                                                        
| 1773 | 1773 | $s .= dol_trunc($mysoc->name, 70, 'right', 'UTF-8', 1)."\n";  | 
                                                        
| 1774 | 1774 |  			$addresslinearray = explode("\n", $mysoc->address); | 
                                                        
| 1775 | - $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1  | 
                                                        |
| 1776 | - $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2  | 
                                                        |
| 1775 | + $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1  | 
                                                        |
| 1776 | + $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2  | 
                                                        |
| 1777 | 1777 | $s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n";  | 
                                                        
| 1778 | 1778 | $s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n";  | 
                                                        
| 1779 | 1779 | $s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n";  | 
                                                        
@@ -1793,14 +1793,14 @@ discard block  | 
                                                    ||
| 1793 | 1793 | $s .= "S\n";  | 
                                                        
| 1794 | 1794 | $s .= dol_trunc($this->thirdparty->name, 70, 'right', 'UTF-8', 1)."\n";  | 
                                                        
| 1795 | 1795 |  		$addresslinearray = explode("\n", $this->thirdparty->address); | 
                                                        
| 1796 | - $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1  | 
                                                        |
| 1797 | - $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2  | 
                                                        |
| 1796 | + $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1  | 
                                                        |
| 1797 | + $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2  | 
                                                        |
| 1798 | 1798 | $s .= dol_trunc($this->thirdparty->zip, 16, 'right', 'UTF-8', 1)."\n";  | 
                                                        
| 1799 | 1799 | $s .= dol_trunc($this->thirdparty->town, 35, 'right', 'UTF-8', 1)."\n";  | 
                                                        
| 1800 | 1800 | $s .= dol_trunc($this->thirdparty->country_code, 2, 'right', 'UTF-8', 1)."\n";  | 
                                                        
| 1801 | 1801 | // ID of payment  | 
                                                        
| 1802 | - $s .= "NON\n"; // NON or QRR  | 
                                                        |
| 1803 | - $s .= "\n"; // QR Code reference if previous field is QRR  | 
                                                        |
| 1802 | + $s .= "NON\n"; // NON or QRR  | 
                                                        |
| 1803 | + $s .= "\n"; // QR Code reference if previous field is QRR  | 
                                                        |
| 1804 | 1804 | // Free text  | 
                                                        
| 1805 | 1805 |  		if ($complementaryinfo) { | 
                                                        
| 1806 | 1806 | $s .= $complementaryinfo."\n";  | 
                                                        
@@ -1029,7 +1029,7 @@ discard block  | 
                                                    ||
| 1029 | 1029 | 'start' => isset($value['start']) ? $value['start'] : '',  | 
                                                        
| 1030 | 1030 | 'end' => isset($value['end']) ? $value['end'] : ''  | 
                                                        
| 1031 | 1031 | );  | 
                                                        
| 1032 | - $out = '<div ' . ($moreparam ? $moreparam : '') . '><div class="nowrap">';  | 
                                                        |
| 1032 | + $out = '<div '.($moreparam ? $moreparam : '').'><div class="nowrap">';  | 
                                                        |
| 1033 | 1033 |  				$out .= $form->selectDate($prefill['start'], $keyprefix.$key.$keysuffix.'_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); | 
                                                        
| 1034 | 1034 | $out .= '</div><div class="nowrap">';  | 
                                                        
| 1035 | 1035 |  				$out .= $form->selectDate($prefill['end'], $keyprefix.$key.$keysuffix.'_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); | 
                                                        
@@ -1054,7 +1054,7 @@ discard block  | 
                                                    ||
| 1054 | 1054 | 'start' => isset($value['start']) ? $value['start'] : '',  | 
                                                        
| 1055 | 1055 | 'end' => isset($value['end']) ? $value['end'] : ''  | 
                                                        
| 1056 | 1056 | );  | 
                                                        
| 1057 | - $out = '<div ' . ($moreparam ? $moreparam : '') . '><div class="nowrap">';  | 
                                                        |
| 1057 | + $out = '<div '.($moreparam ? $moreparam : '').'><div class="nowrap">';  | 
                                                        |
| 1058 | 1058 |  				$out .= $form->selectDate($prefill['start'], $keyprefix.$key.$keysuffix.'_start', 1, 1, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"), 'tzuserrel'); | 
                                                        
| 1059 | 1059 | $out .= '</div><div class="nowrap">';  | 
                                                        
| 1060 | 1060 |  				$out .= $form->selectDate($prefill['end'], $keyprefix.$key.$keysuffix.'_end', 1, 1, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); | 
                                                        
@@ -1077,24 +1077,24 @@ discard block  | 
                                                    ||
| 1077 | 1077 |  			$out ='<link rel="stylesheet" href="'.dol_buildpath('/myfield/css/fontawesome-iconpicker.min.css', 1).'">'; | 
                                                        
| 1078 | 1078 |  			$out.='<script src="'.dol_buildpath('/myfield/js/fontawesome-iconpicker.min.js', 1).'"></script>'; | 
                                                        
| 1079 | 1079 | */  | 
                                                        
| 1080 | - $out.= '<input type="text" class="form-control icp icp-auto iconpicker-element iconpicker-input flat '.$morecss.' maxwidthonsmartphone"';  | 
                                                        |
| 1081 | - $out.= ' name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>';  | 
                                                        |
| 1080 | + $out .= '<input type="text" class="form-control icp icp-auto iconpicker-element iconpicker-input flat '.$morecss.' maxwidthonsmartphone"';  | 
                                                        |
| 1081 | + $out .= ' name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>';  | 
                                                        |
| 1082 | 1082 |  			if (getDolGlobalInt('MAIN_ADD_ICONPICKER_JS')) { | 
                                                        
| 1083 | - $out.='<script>';  | 
                                                        |
| 1084 | -				$options="{ title: '<b>".$langs->trans("IconFieldSelector")."</b>', placement: 'right', showFooter: false, templates: {"; | 
                                                        |
| 1085 | - $options.="iconpicker: '<div class=\"iconpicker\"><div style=\"background-color:#EFEFEF;\" class=\"iconpicker-items\"></div></div>',";  | 
                                                        |
| 1086 | - $options.="iconpickerItem: '<a role=\"button\" href=\"#\" class=\"iconpicker-item\" style=\"background-color:#DDDDDD;\"><i></i></a>',";  | 
                                                        |
| 1083 | + $out .= '<script>';  | 
                                                        |
| 1084 | +				$options = "{ title: '<b>".$langs->trans("IconFieldSelector")."</b>', placement: 'right', showFooter: false, templates: {"; | 
                                                        |
| 1085 | + $options .= "iconpicker: '<div class=\"iconpicker\"><div style=\"background-color:#EFEFEF;\" class=\"iconpicker-items\"></div></div>',";  | 
                                                        |
| 1086 | + $options .= "iconpickerItem: '<a role=\"button\" href=\"#\" class=\"iconpicker-item\" style=\"background-color:#DDDDDD;\"><i></i></a>',";  | 
                                                        |
| 1087 | 1087 |  				// $options.="buttons: '<button style=\"background-color:#FFFFFF;\" class=\"iconpicker-btn iconpicker-btn-cancel btn btn-default btn-sm\">".$langs->trans("Cancel")."</button>"; | 
                                                        
| 1088 | 1088 |  				// $options.="<button style=\"background-color:#FFFFFF;\" class=\"iconpicker-btn iconpicker-btn-accept btn btn-primary btn-sm\">".$langs->trans("Save")."</button>',"; | 
                                                        
| 1089 | - $options.="footer: '<div class=\"popover-footer\" style=\"background-color:#EFEFEF;\"></div>',";  | 
                                                        |
| 1090 | -				$options.="search: '<input type=\"search\" class\"form-control iconpicker-search\" placeholder=\"".$langs->trans("TypeToFilter")."\" />',"; | 
                                                        |
| 1091 | - $options.="popover: '<div class=\"iconpicker-popover popover\">";  | 
                                                        |
| 1092 | - $options.=" <div class=\"arrow\" ></div>";  | 
                                                        |
| 1093 | - $options.=" <div class=\"popover-title\" style=\"text-align:center;background-color:#EFEFEF;\"></div>";  | 
                                                        |
| 1094 | - $options.=" <div class=\"popover-content \" ></div>";  | 
                                                        |
| 1095 | - $options.="</div>'}}";  | 
                                                        |
| 1096 | -				$out.="$('#".$keyprefix.$key.$keysuffix."').iconpicker(".$options.");"; | 
                                                        |
| 1097 | - $out.='</script>';  | 
                                                        |
| 1089 | + $options .= "footer: '<div class=\"popover-footer\" style=\"background-color:#EFEFEF;\"></div>',";  | 
                                                        |
| 1090 | +				$options .= "search: '<input type=\"search\" class\"form-control iconpicker-search\" placeholder=\"".$langs->trans("TypeToFilter")."\" />',"; | 
                                                        |
| 1091 | + $options .= "popover: '<div class=\"iconpicker-popover popover\">";  | 
                                                        |
| 1092 | + $options .= " <div class=\"arrow\" ></div>";  | 
                                                        |
| 1093 | + $options .= " <div class=\"popover-title\" style=\"text-align:center;background-color:#EFEFEF;\"></div>";  | 
                                                        |
| 1094 | + $options .= " <div class=\"popover-content \" ></div>";  | 
                                                        |
| 1095 | + $options .= "</div>'}}";  | 
                                                        |
| 1096 | +				$out .= "$('#".$keyprefix.$key.$keysuffix."').iconpicker(".$options.");"; | 
                                                        |
| 1097 | + $out .= '</script>';  | 
                                                        |
| 1098 | 1098 | }  | 
                                                        
| 1099 | 1099 |  		} elseif ($type == 'text') { | 
                                                        
| 1100 | 1100 |  			if (!preg_match('/search_/', $keyprefix)) {		// If keyprefix is search_ or search_options_, we must just use a simple text field | 
                                                        
@@ -1120,7 +1120,7 @@ discard block  | 
                                                    ||
| 1120 | 1120 |  				} else { | 
                                                        
| 1121 | 1121 | $checked = ' value="1" ';  | 
                                                        
| 1122 | 1122 | }  | 
                                                        
| 1123 | - $out = '<input type="hidden" name="'.$keyprefix.$key.$keysuffix.'_boolean" value="1">'; // A hidden field ending with "_boolean" that is always set to 1.  | 
                                                        |
| 1123 | + $out = '<input type="hidden" name="'.$keyprefix.$key.$keysuffix.'_boolean" value="1">'; // A hidden field ending with "_boolean" that is always set to 1.  | 
                                                        |
| 1124 | 1124 | $out .= '<input type="checkbox" class="flat valignmiddle'.($morecss ? ' '.$morecss : '').' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam ? $moreparam : '').'>';  | 
                                                        
| 1125 | 1125 |  			} else { | 
                                                        
| 1126 | 1126 | $out = $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1);  | 
                                                        
@@ -1593,10 +1593,10 @@ discard block  | 
                                                    ||
| 1593 | 1593 | |
| 1594 | 1594 |  			$tmparray = explode(':', $param_list[0]); | 
                                                        
| 1595 | 1595 | |
| 1596 | - $element = $extrafieldsobjectkey; // $extrafieldsobjectkey comes from $object->table_element but we need $object->element  | 
                                                        |
| 1596 | + $element = $extrafieldsobjectkey; // $extrafieldsobjectkey comes from $object->table_element but we need $object->element  | 
                                                        |
| 1597 | 1597 |  			if ($element == 'socpeople') { | 
                                                        
| 1598 | 1598 | $element = 'contact';  | 
                                                        
| 1599 | -			} elseif ( $element == 'projet' ) { | 
                                                        |
| 1599 | +			} elseif ($element == 'projet') { | 
                                                        |
| 1600 | 1600 | $element = 'project';  | 
                                                        
| 1601 | 1601 | }  | 
                                                        
| 1602 | 1602 | |
@@ -1641,7 +1641,7 @@ discard block  | 
                                                    ||
| 1641 | 1641 | |
| 1642 | 1642 | $label = $this->attributes[$extrafieldsobjectkey]['label'][$key];  | 
                                                        
| 1643 | 1643 | $type = $this->attributes[$extrafieldsobjectkey]['type'][$key];  | 
                                                        
| 1644 | - $size = $this->attributes[$extrafieldsobjectkey]['size'][$key]; // Can be '255', '24,8'...  | 
                                                        |
| 1644 | + $size = $this->attributes[$extrafieldsobjectkey]['size'][$key]; // Can be '255', '24,8'...  | 
                                                        |
| 1645 | 1645 | $default = $this->attributes[$extrafieldsobjectkey]['default'][$key];  | 
                                                        
| 1646 | 1646 | $computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key];  | 
                                                        
| 1647 | 1647 | $unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key];  | 
                                                        
@@ -1663,7 +1663,7 @@ discard block  | 
                                                    ||
| 1663 | 1663 |  		if ($type == 'date') { | 
                                                        
| 1664 | 1664 | $showsize = 10;  | 
                                                        
| 1665 | 1665 |  			if ($value !== '') { | 
                                                        
| 1666 | - $value = dol_print_date($value, 'day'); // For date without hour, date is always GMT for storage and output  | 
                                                        |
| 1666 | + $value = dol_print_date($value, 'day'); // For date without hour, date is always GMT for storage and output  | 
                                                        |
| 1667 | 1667 | }  | 
                                                        
| 1668 | 1668 |  		} elseif ($type == 'datetime') { | 
                                                        
| 1669 | 1669 | $showsize = 19;  | 
                                                        
@@ -1807,13 +1807,13 @@ discard block  | 
                                                    ||
| 1807 | 1807 | $toprint = array();  | 
                                                        
| 1808 | 1808 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 1809 | 1809 |  					if ($obj->rowid) { | 
                                                        
| 1810 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';  | 
                                                        |
| 1810 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';  | 
                                                        |
| 1811 | 1811 | $c = new Categorie($this->db);  | 
                                                        
| 1812 | 1812 | $result = $c->fetch($obj->rowid);  | 
                                                        
| 1813 | 1813 |  						if ($result > 0) { | 
                                                        
| 1814 | 1814 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text  | 
                                                        
| 1815 | 1815 |  							foreach ($ways as $way) { | 
                                                        
| 1816 | -								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; | 
                                                        |
| 1816 | +								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.img_object('', 'category').' '.$way.'</li>'; | 
                                                        |
| 1817 | 1817 | }  | 
                                                        
| 1818 | 1818 | }  | 
                                                        
| 1819 | 1819 | }  | 
                                                        
@@ -2027,13 +2027,13 @@ discard block  | 
                                                    ||
| 2027 | 2027 |  	{ | 
                                                        
| 2028 | 2028 | global $conf, $langs;  | 
                                                        
| 2029 | 2029 | |
| 2030 | - $tagtype='tr';  | 
                                                        |
| 2031 | - $tagtype_dyn='td';  | 
                                                        |
| 2030 | + $tagtype = 'tr';  | 
                                                        |
| 2031 | + $tagtype_dyn = 'td';  | 
                                                        |
| 2032 | 2032 | |
| 2033 | -		if ($display_type=='line') { | 
                                                        |
| 2034 | - $tagtype='div';  | 
                                                        |
| 2035 | - $tagtype_dyn='span';  | 
                                                        |
| 2036 | - $colspan=0;  | 
                                                        |
| 2033 | +		if ($display_type == 'line') { | 
                                                        |
| 2034 | + $tagtype = 'div';  | 
                                                        |
| 2035 | + $tagtype_dyn = 'span';  | 
                                                        |
| 2036 | + $colspan = 0;  | 
                                                        |
| 2037 | 2037 | }  | 
                                                        
| 2038 | 2038 | |
| 2039 | 2039 | $extrafield_param = $this->attributes[$object->table_element]['param'][$key];  | 
                                                        
@@ -2053,12 +2053,12 @@ discard block  | 
                                                    ||
| 2053 | 2053 |  		if ($mode == 'create') { | 
                                                        
| 2054 | 2054 | // On create mode, force separator group to not be collapsible  | 
                                                        
| 2055 | 2055 | $extrafield_collapse_display_value = 1;  | 
                                                        
| 2056 | - $expand_display = true; // We force group to be shown expanded  | 
                                                        |
| 2056 | + $expand_display = true; // We force group to be shown expanded  | 
                                                        |
| 2057 | 2057 | $disabledcookiewrite = 1; // We keep status of group unchanged into the cookie  | 
                                                        
| 2058 | 2058 | }  | 
                                                        
| 2059 | 2059 | |
| 2060 | 2060 | $out = '<'.$tagtype.' id="trextrafieldseparator'.$key.(!empty($object->id) ? '_'.$object->id : '').'" class="trextrafieldseparator trextrafieldseparator'.$key.(!empty($object->id) ? '_'.$object->id : '').'">';  | 
                                                        
| 2061 | - $out .= '<'.$tagtype_dyn.' '.(!empty($colspan) ? 'colspan="' . $colspan . '"' : '').'>';  | 
                                                        |
| 2061 | + $out .= '<'.$tagtype_dyn.' '.(!empty($colspan) ? 'colspan="'.$colspan.'"' : '').'>';  | 
                                                        |
| 2062 | 2062 | // Some js code will be injected here to manage the collapsing of extrafields  | 
                                                        
| 2063 | 2063 | // Output the picto  | 
                                                        
| 2064 | 2064 | $out .= '<span class="'.($extrafield_collapse_display_value ? 'cursorpointer ' : '').($extrafield_collapse_display_value == 0 ? 'fas fa-square opacitymedium' : 'far fa-'.(($expand_display ? 'minus' : 'plus').'-square')).'"></span>';  | 
                                                        
@@ -2140,7 +2140,7 @@ discard block  | 
                                                    ||
| 2140 | 2140 | continue;  | 
                                                        
| 2141 | 2141 | }  | 
                                                        
| 2142 | 2142 | |
| 2143 | -				if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && (! in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'checkbox', 'chkbxlst')))) { | 
                                                        |
| 2143 | +				if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && (!in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'checkbox', 'chkbxlst')))) { | 
                                                        |
| 2144 | 2144 | //when unticking boolean field, it's not set in POST  | 
                                                        
| 2145 | 2145 | continue;  | 
                                                        
| 2146 | 2146 | }  | 
                                                        
@@ -2169,7 +2169,7 @@ discard block  | 
                                                    ||
| 2169 | 2169 | $onlykey === '@GETPOSTISSET'  | 
                                                        
| 2170 | 2170 |  						&& in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'checkbox', 'chkbxlst')) | 
                                                        
| 2171 | 2171 | && in_array(abs($enabled), array(2, 5))  | 
                                                        
| 2172 | -						&& ! GETPOSTISSET('options_' . $key) // Update hidden checkboxes and multiselect only if they are provided | 
                                                        |
| 2172 | +						&& !GETPOSTISSET('options_'.$key) // Update hidden checkboxes and multiselect only if they are provided | 
                                                        |
| 2173 | 2173 | )  | 
                                                        
| 2174 | 2174 |  				) { | 
                                                        
| 2175 | 2175 | continue;  | 
                                                        
@@ -2296,16 +2296,16 @@ discard block  | 
                                                    ||
| 2296 | 2296 | }  | 
                                                        
| 2297 | 2297 | |
| 2298 | 2298 |  				if (in_array($key_type, array('date'))) { | 
                                                        
| 2299 | - $dateparamname_start = $keysuffix . 'options_' . $key . $keyprefix . '_start';  | 
                                                        |
| 2300 | - $dateparamname_end = $keysuffix . 'options_' . $key . $keyprefix . '_end';  | 
                                                        |
| 2301 | -					if (GETPOST($dateparamname_start . 'year') || GETPOST($dateparamname_end . 'year')) { | 
                                                        |
| 2299 | + $dateparamname_start = $keysuffix.'options_'.$key.$keyprefix.'_start';  | 
                                                        |
| 2300 | + $dateparamname_end = $keysuffix.'options_'.$key.$keyprefix.'_end';  | 
                                                        |
| 2301 | +					if (GETPOST($dateparamname_start.'year') || GETPOST($dateparamname_end.'year')) { | 
                                                        |
| 2302 | 2302 | $value_key = array();  | 
                                                        
| 2303 | 2303 | // values provided as a component year, month, day, etc.  | 
                                                        
| 2304 | -						if (GETPOST($dateparamname_start . 'year')) { | 
                                                        |
| 2305 | - $value_key['start'] = dol_mktime(0, 0, 0, GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int'));  | 
                                                        |
| 2304 | +						if (GETPOST($dateparamname_start.'year')) { | 
                                                        |
| 2305 | + $value_key['start'] = dol_mktime(0, 0, 0, GETPOST($dateparamname_start.'month', 'int'), GETPOST($dateparamname_start.'day', 'int'), GETPOST($dateparamname_start.'year', 'int'));  | 
                                                        |
| 2306 | 2306 | }  | 
                                                        
| 2307 | -						if (GETPOST($dateparamname_start . 'year')) { | 
                                                        |
| 2308 | - $value_key['end'] = dol_mktime(23, 59, 59, GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'));  | 
                                                        |
| 2307 | +						if (GETPOST($dateparamname_start.'year')) { | 
                                                        |
| 2308 | + $value_key['end'] = dol_mktime(23, 59, 59, GETPOST($dateparamname_end.'month', 'int'), GETPOST($dateparamname_end.'day', 'int'), GETPOST($dateparamname_end.'year', 'int'));  | 
                                                        |
| 2309 | 2309 | }  | 
                                                        
| 2310 | 2310 |  					} elseif (GETPOST($keysuffix."options_".$key.$keyprefix."year")) { | 
                                                        
| 2311 | 2311 | // Clean parameters  | 
                                                        
@@ -2314,22 +2314,22 @@ discard block  | 
                                                    ||
| 2314 | 2314 | continue; // Value was not provided, we should not set it.  | 
                                                        
| 2315 | 2315 | }  | 
                                                        
| 2316 | 2316 |  				} elseif (in_array($key_type, array('datetime', 'datetimegmt'))) { | 
                                                        
| 2317 | - $dateparamname_start = $keysuffix . 'options_' . $key . $keyprefix . '_start';  | 
                                                        |
| 2318 | - $dateparamname_end = $keysuffix . 'options_' . $key . $keyprefix . '_end';  | 
                                                        |
| 2319 | -					if (GETPOST($dateparamname_start . 'year') && GETPOST($dateparamname_end . 'year')) { | 
                                                        |
| 2317 | + $dateparamname_start = $keysuffix.'options_'.$key.$keyprefix.'_start';  | 
                                                        |
| 2318 | + $dateparamname_end = $keysuffix.'options_'.$key.$keyprefix.'_end';  | 
                                                        |
| 2319 | +					if (GETPOST($dateparamname_start.'year') && GETPOST($dateparamname_end.'year')) { | 
                                                        |
| 2320 | 2320 | // values provided as a date pair (start date + end date), each date being broken down as year, month, day, etc.  | 
                                                        
| 2321 | - $dateparamname_end_hour = GETPOST($dateparamname_end . 'hour', 'int') != '-1' ? GETPOST($dateparamname_end . 'hour', 'int') : '23';  | 
                                                        |
| 2322 | - $dateparamname_end_min = GETPOST($dateparamname_end . 'min', 'int') != '-1' ? GETPOST($dateparamname_end . 'min', 'int') : '59';  | 
                                                        |
| 2323 | - $dateparamname_end_sec = GETPOST($dateparamname_end . 'sec', 'int') != '-1' ? GETPOST($dateparamname_end . 'sec', 'int') : '59';  | 
                                                        |
| 2321 | + $dateparamname_end_hour = GETPOST($dateparamname_end.'hour', 'int') != '-1' ? GETPOST($dateparamname_end.'hour', 'int') : '23';  | 
                                                        |
| 2322 | + $dateparamname_end_min = GETPOST($dateparamname_end.'min', 'int') != '-1' ? GETPOST($dateparamname_end.'min', 'int') : '59';  | 
                                                        |
| 2323 | + $dateparamname_end_sec = GETPOST($dateparamname_end.'sec', 'int') != '-1' ? GETPOST($dateparamname_end.'sec', 'int') : '59';  | 
                                                        |
| 2324 | 2324 |  						if ($key_type == 'datetimegmt') { | 
                                                        
| 2325 | 2325 | $value_key = array(  | 
                                                        
| 2326 | - 'start' => dol_mktime(GETPOST($dateparamname_start . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int'), 'gmt'),  | 
                                                        |
| 2327 | - 'end' => dol_mktime($dateparamname_end_hour, $dateparamname_end_min, $dateparamname_end_sec, GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'gmt')  | 
                                                        |
| 2326 | + 'start' => dol_mktime(GETPOST($dateparamname_start.'hour', 'int'), GETPOST($dateparamname_start.'min', 'int'), GETPOST($dateparamname_start.'sec', 'int'), GETPOST($dateparamname_start.'month', 'int'), GETPOST($dateparamname_start.'day', 'int'), GETPOST($dateparamname_start.'year', 'int'), 'gmt'),  | 
                                                        |
| 2327 | + 'end' => dol_mktime($dateparamname_end_hour, $dateparamname_end_min, $dateparamname_end_sec, GETPOST($dateparamname_end.'month', 'int'), GETPOST($dateparamname_end.'day', 'int'), GETPOST($dateparamname_end.'year', 'int'), 'gmt')  | 
                                                        |
| 2328 | 2328 | );  | 
                                                        
| 2329 | 2329 |  						} else { | 
                                                        
| 2330 | 2330 | $value_key = array(  | 
                                                        
| 2331 | - 'start' => dol_mktime(GETPOST($dateparamname_start . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int'), 'tzuserrel'),  | 
                                                        |
| 2332 | - 'end' => dol_mktime($dateparamname_end_hour, $dateparamname_end_min, $dateparamname_end_sec, GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'tzuserrel')  | 
                                                        |
| 2331 | + 'start' => dol_mktime(GETPOST($dateparamname_start.'hour', 'int'), GETPOST($dateparamname_start.'min', 'int'), GETPOST($dateparamname_start.'sec', 'int'), GETPOST($dateparamname_start.'month', 'int'), GETPOST($dateparamname_start.'day', 'int'), GETPOST($dateparamname_start.'year', 'int'), 'tzuserrel'),  | 
                                                        |
| 2332 | + 'end' => dol_mktime($dateparamname_end_hour, $dateparamname_end_min, $dateparamname_end_sec, GETPOST($dateparamname_end.'month', 'int'), GETPOST($dateparamname_end.'day', 'int'), GETPOST($dateparamname_end.'year', 'int'), 'tzuserrel')  | 
                                                        |
| 2333 | 2333 | );  | 
                                                        
| 2334 | 2334 | }  | 
                                                        
| 2335 | 2335 |  					} elseif (GETPOST($keysuffix."options_".$key.$keyprefix."year")) { | 
                                                        
@@ -259,32 +259,32 @@ discard block  | 
                                                    ||
| 259 | 259 | $r = 0;  | 
                                                        
| 260 | 260 | // Add here entries to declare new permissions  | 
                                                        
| 261 | 261 | /* BEGIN MODULEBUILDER PERMISSIONS */  | 
                                                        
| 262 | -		$this->rights[$r][0] = $this->numero . sprintf('%02d', (0 * 10) + 1); | 
                                                        |
| 262 | +		$this->rights[$r][0] = $this->numero.sprintf('%02d', (0 * 10) + 1); | 
                                                        |
| 263 | 263 | $this->rights[$r][1] = 'Read objects of Ai';  | 
                                                        
| 264 | 264 | $this->rights[$r][4] = 'availabilities';  | 
                                                        
| 265 | 265 | $this->rights[$r][5] = 'read';  | 
                                                        
| 266 | 266 | $r++;  | 
                                                        
| 267 | -		$this->rights[$r][0] = $this->numero . sprintf('%02d', (0 * 10) + 2); | 
                                                        |
| 267 | +		$this->rights[$r][0] = $this->numero.sprintf('%02d', (0 * 10) + 2); | 
                                                        |
| 268 | 268 | $this->rights[$r][1] = 'Create/Update objects of Ai';  | 
                                                        
| 269 | 269 | $this->rights[$r][4] = 'availabilities';  | 
                                                        
| 270 | 270 | $this->rights[$r][5] = 'write';  | 
                                                        
| 271 | 271 | $r++;  | 
                                                        
| 272 | -		$this->rights[$r][0] = $this->numero . sprintf('%02d', (0 * 10) + 3); | 
                                                        |
| 272 | +		$this->rights[$r][0] = $this->numero.sprintf('%02d', (0 * 10) + 3); | 
                                                        |
| 273 | 273 | $this->rights[$r][1] = 'Delete objects of Ai';  | 
                                                        
| 274 | 274 | $this->rights[$r][4] = 'availabilities';  | 
                                                        
| 275 | 275 | $this->rights[$r][5] = 'delete';  | 
                                                        
| 276 | 276 | $r++;  | 
                                                        
| 277 | -		$this->rights[$r][0] = $this->numero . sprintf('%02d', (1 * 10) + 1); | 
                                                        |
| 277 | +		$this->rights[$r][0] = $this->numero.sprintf('%02d', (1 * 10) + 1); | 
                                                        |
| 278 | 278 | $this->rights[$r][1] = 'Read Calendar object of Ai';  | 
                                                        
| 279 | 279 | $this->rights[$r][4] = 'calendar';  | 
                                                        
| 280 | 280 | $this->rights[$r][5] = 'read';  | 
                                                        
| 281 | 281 | $r++;  | 
                                                        
| 282 | -		$this->rights[$r][0] = $this->numero . sprintf('%02d', (1 * 10) + 2); | 
                                                        |
| 282 | +		$this->rights[$r][0] = $this->numero.sprintf('%02d', (1 * 10) + 2); | 
                                                        |
| 283 | 283 | $this->rights[$r][1] = 'Create/Update Calendar object of Ai';  | 
                                                        
| 284 | 284 | $this->rights[$r][4] = 'calendar';  | 
                                                        
| 285 | 285 | $this->rights[$r][5] = 'write';  | 
                                                        
| 286 | 286 | $r++;  | 
                                                        
| 287 | -		$this->rights[$r][0] = $this->numero . sprintf('%02d', (1 * 10) + 3); | 
                                                        |
| 287 | +		$this->rights[$r][0] = $this->numero.sprintf('%02d', (1 * 10) + 3); | 
                                                        |
| 288 | 288 | $this->rights[$r][1] = 'Delete Calendar object of Ai';  | 
                                                        
| 289 | 289 | $this->rights[$r][4] = 'calendar';  | 
                                                        
| 290 | 290 | $this->rights[$r][5] = 'delete';  | 
                                                        
@@ -324,13 +324,13 @@ discard block  | 
                                                    ||
| 324 | 324 | 'leftmenu'=> 'ai',  | 
                                                        
| 325 | 325 | 'url'=> '/ai/aiindex.php',  | 
                                                        
| 326 | 326 | 'langs'=> 'ai',  | 
                                                        
| 327 | - 'position'=> 1100+$r,  | 
                                                        |
| 327 | + 'position'=> 1100 + $r,  | 
                                                        |
| 328 | 328 | 'enabled'=> '1',  | 
                                                        
| 329 | 329 | 'perms'=> '$user->rights->ai->read',  | 
                                                        
| 330 | 330 | 'user'=> 0  | 
                                                        
| 331 | 331 | );  | 
                                                        
| 332 | 332 | |
| 333 | - $this->menu[$r++]=array(  | 
                                                        |
| 333 | + $this->menu[$r++] = array(  | 
                                                        |
| 334 | 334 | // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode  | 
                                                        
| 335 | 335 | 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=ai',  | 
                                                        
| 336 | 336 | // This is a Left menu entry  | 
                                                        
@@ -341,7 +341,7 @@ discard block  | 
                                                    ||
| 341 | 341 | 'url'=>'/ai/list.php',  | 
                                                        
| 342 | 342 | // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.  | 
                                                        
| 343 | 343 | 'langs'=>'ai',  | 
                                                        
| 344 | - 'position'=>1100+$r,  | 
                                                        |
| 344 | + 'position'=>1100 + $r,  | 
                                                        |
| 345 | 345 | // Define condition to show or hide menu entry. Use '$conf->ai->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.  | 
                                                        
| 346 | 346 | 'enabled'=>'$conf->ai->enabled',  | 
                                                        
| 347 | 347 | // Use 'perms'=>'$user->rights->ai->level1->level2' if you want your menu with a permission rules  | 
                                                        
@@ -350,7 +350,7 @@ discard block  | 
                                                    ||
| 350 | 350 | // 0=Menu for internal users, 1=external users, 2=both  | 
                                                        
| 351 | 351 | 'user'=>2,  | 
                                                        
| 352 | 352 | );  | 
                                                        
| 353 | - $this->menu[$r++]=array(  | 
                                                        |
| 353 | + $this->menu[$r++] = array(  | 
                                                        |
| 354 | 354 | // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode  | 
                                                        
| 355 | 355 | 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=ai_list',  | 
                                                        
| 356 | 356 | // This is a Left menu entry  | 
                                                        
@@ -361,7 +361,7 @@ discard block  | 
                                                    ||
| 361 | 361 | 'url'=>'/ai/ai_card.php?action=create',  | 
                                                        
| 362 | 362 | // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.  | 
                                                        
| 363 | 363 | 'langs'=>'ai',  | 
                                                        
| 364 | - 'position'=>1100+$r,  | 
                                                        |
| 364 | + 'position'=>1100 + $r,  | 
                                                        |
| 365 | 365 | // Define condition to show or hide menu entry. Use '$conf->ai->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.  | 
                                                        
| 366 | 366 | 'enabled'=>'$conf->ai->enabled',  | 
                                                        
| 367 | 367 | // Use 'perms'=>'$user->rights->ai->level1->level2' if you want your menu with a permission rules  | 
                                                        
@@ -30,14 +30,14 @@ discard block  | 
                                                    ||
| 30 | 30 | |
| 31 | 31 | // Load Dolibarr environment  | 
                                                        
| 32 | 32 | require '../../main.inc.php';  | 
                                                        
| 33 | -require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 34 | -require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php';  | 
                                                        |
| 35 | -require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';  | 
                                                        |
| 36 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';  | 
                                                        |
| 37 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';  | 
                                                        |
| 38 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';  | 
                                                        |
| 39 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';  | 
                                                        |
| 40 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formintervention.class.php';  | 
                                                        |
| 33 | +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 34 | +require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';  | 
                                                        |
| 35 | +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';  | 
                                                        |
| 36 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';  | 
                                                        |
| 37 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';  | 
                                                        |
| 38 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';  | 
                                                        |
| 39 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';  | 
                                                        |
| 40 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formintervention.class.php';  | 
                                                        |
| 41 | 41 | |
| 42 | 42 | // Load translation files required by the page  | 
                                                        
| 43 | 43 |  $langsLoad = array('projects', 'bills', 'orders', 'companies'); | 
                                                        
@@ -161,10 +161,10 @@ discard block  | 
                                                    ||
| 161 | 161 | // Definition of fields for list  | 
                                                        
| 162 | 162 | $arrayfields = array();  | 
                                                        
| 163 | 163 |  $arrayfields['t.element_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1); | 
                                                        
| 164 | -$arrayfields['p.fk_soc'] = array('label'=>$langs->trans("ThirdParty"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1','checked'=>1); | 
                                                        |
| 164 | +$arrayfields['p.fk_soc'] = array('label'=>$langs->trans("ThirdParty"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1', 'checked'=>1); | 
                                                        |
| 165 | 165 |  $arrayfields['s.name_alias'] = array('label'=>$langs->trans("AliasNameShort"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1'); | 
                                                        
| 166 | 166 |  if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {	// Not a dedicated task | 
                                                        
| 167 | -	if (! empty($allprojectforuser)) { | 
                                                        |
| 167 | +	if (!empty($allprojectforuser)) { | 
                                                        |
| 168 | 168 |  		$arrayfields['p.project_ref'] = ['label' => $langs->trans('RefProject'), 'checked' => 1]; | 
                                                        
| 169 | 169 |  		$arrayfields['p.project_label'] = ['label' => $langs->trans('ProjectLabel'), 'checked' => 1]; | 
                                                        
| 170 | 170 | }  | 
                                                        
@@ -173,8 +173,8 @@ discard block  | 
                                                    ||
| 173 | 173 | }  | 
                                                        
| 174 | 174 |  $arrayfields['author'] = array('label' => $langs->trans("By"), 'checked' => 1); | 
                                                        
| 175 | 175 |  $arrayfields['t.note'] = array('label' => $langs->trans("Note"), 'checked' => 1); | 
                                                        
| 176 | -if (!getDolGlobalInt('PROJECT_HIDE_TASKS') && getDolGlobalInt('PROJECT_BILL_TIME_SPENT') && !$projectstatic->usage_bill_time ) { | 
                                                        |
| 177 | - $projectstatic->usage_bill_time=1;  | 
                                                        |
| 176 | +if (!getDolGlobalInt('PROJECT_HIDE_TASKS') && getDolGlobalInt('PROJECT_BILL_TIME_SPENT') && !$projectstatic->usage_bill_time) { | 
                                                        |
| 177 | + $projectstatic->usage_bill_time = 1;  | 
                                                        |
| 178 | 178 | }  | 
                                                        
| 179 | 179 |  if (isModEnabled('service') && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) { | 
                                                        
| 180 | 180 |  	$arrayfields['t.fk_product'] = array('label' => $langs->trans("Product"), 'checked' => 1); | 
                                                        
@@ -183,7 +183,7 @@ discard block  | 
                                                    ||
| 183 | 183 |  $arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>isModEnabled("salaries")); | 
                                                        
| 184 | 184 |  $arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time)); | 
                                                        
| 185 | 185 | // Extra fields  | 
                                                        
| 186 | -include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';  | 
                                                        |
| 186 | +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';  | 
                                                        |
| 187 | 187 | |
| 188 | 188 | $arrayfields = dol_sort_array($arrayfields, 'position');  | 
                                                        
| 189 | 189 | |
@@ -194,7 +194,7 @@ discard block  | 
                                                    ||
| 194 | 194 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');  | 
                                                        
| 195 | 195 | }  | 
                                                        
| 196 | 196 | |
| 197 | -include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';  | 
                                                        |
| 197 | +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';  | 
                                                        |
| 198 | 198 | |
| 199 | 199 | // Purge search criteria  | 
                                                        
| 200 | 200 |  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers | 
                                                        
@@ -384,10 +384,10 @@ discard block  | 
                                                    ||
| 384 | 384 | }  | 
                                                        
| 385 | 385 | |
| 386 | 386 |  if ($action == 'confirm_deleteline' && $confirm == "yes" && ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer'))) { | 
                                                        
| 387 | -	$object->fetchTimeSpent(GETPOST('lineid', 'int'));    // load properties like $object->timespent_xxx | 
                                                        |
| 387 | +	$object->fetchTimeSpent(GETPOST('lineid', 'int')); // load properties like $object->timespent_xxx | 
                                                        |
| 388 | 388 | |
| 389 | 389 |  	if (in_array($object->timespent_fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) { | 
                                                        
| 390 | - $result = $object->delTimeSpent($user); // delete line with $object->timespent_id  | 
                                                        |
| 390 | + $result = $object->delTimeSpent($user); // delete line with $object->timespent_id  | 
                                                        |
| 391 | 391 | |
| 392 | 392 |  		if ($result < 0) { | 
                                                        
| 393 | 393 |  			$langs->load("errors"); | 
                                                        
@@ -407,7 +407,7 @@ discard block  | 
                                                    ||
| 407 | 407 |  		if (count($tasksarray) > 0) { | 
                                                        
| 408 | 408 | $id = $tasksarray[0]->id;  | 
                                                        
| 409 | 409 |  		} else { | 
                                                        
| 410 | -			header("Location: " . DOL_URL_ROOT . '/projet/tasks.php?id=' . $projectstatic->id . ($withproject ? '&withproject=1' : '') . (empty($mode) ? '' : '&mode=' . $mode)); | 
                                                        |
| 410 | +			header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.($withproject ? '&withproject=1' : '').(empty($mode) ? '' : '&mode='.$mode)); | 
                                                        |
| 411 | 411 | exit;  | 
                                                        
| 412 | 412 | }  | 
                                                        
| 413 | 413 | }  | 
                                                        
@@ -444,9 +444,9 @@ discard block  | 
                                                    ||
| 444 | 444 |  	if (!($projectstatic->thirdparty->id > 0)) { | 
                                                        
| 445 | 445 |  		setEventMessages($langs->trans("ThirdPartyRequiredToGenerateInvoice"), null, 'errors'); | 
                                                        
| 446 | 446 |  	} else { | 
                                                        
| 447 | - include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';  | 
                                                        |
| 448 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 449 | - include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 447 | + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';  | 
                                                        |
| 448 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 449 | + include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 450 | 450 | |
| 451 | 451 | $tmpinvoice = new Facture($db);  | 
                                                        
| 452 | 452 | $tmptimespent = new Task($db);  | 
                                                        
@@ -511,7 +511,7 @@ discard block  | 
                                                    ||
| 511 | 511 | $arrayoftasks = array();  | 
                                                        
| 512 | 512 |  				foreach ($toselect as $key => $value) { | 
                                                        
| 513 | 513 | // Get userid, timepent  | 
                                                        
| 514 | - $object->fetchTimeSpent($value); // $value is ID of 1 line in timespent table  | 
                                                        |
| 514 | + $object->fetchTimeSpent($value); // $value is ID of 1 line in timespent table  | 
                                                        |
| 515 | 515 | $arrayoftasks[$object->timespent_fk_user][(int) $object->timespent_fk_product]['timespent'] += $object->timespent_duration;  | 
                                                        
| 516 | 516 | $arrayoftasks[$object->timespent_fk_user][(int) $object->timespent_fk_product]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm);  | 
                                                        
| 517 | 517 | }  | 
                                                        
@@ -583,7 +583,7 @@ discard block  | 
                                                    ||
| 583 | 583 | }  | 
                                                        
| 584 | 584 | |
| 585 | 585 | // Add lines  | 
                                                        
| 586 | -						$lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username) . ' : ' . $qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0)); | 
                                                        |
| 586 | +						$lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0)); | 
                                                        |
| 587 | 587 |  						if ($lineid < 0) { | 
                                                        
| 588 | 588 | $error++;  | 
                                                        
| 589 | 589 | setEventMessages(null, $tmpinvoice->errors, 'errors');  | 
                                                        
@@ -616,16 +616,16 @@ discard block  | 
                                                    ||
| 616 | 616 | |
| 617 | 617 | $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration;  | 
                                                        
| 618 | 618 | $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm;  | 
                                                        
| 619 | - $arrayoftasks[$object->timespent_id]['note'] = $ftask->ref . ' - ' . $ftask->label . ' - ' . $username;  | 
                                                        |
| 619 | + $arrayoftasks[$object->timespent_id]['note'] = $ftask->ref.' - '.$ftask->label.' - '.$username;  | 
                                                        |
| 620 | 620 | $arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $object->timespent_note);  | 
                                                        
| 621 | 621 | |
| 622 | 622 |  					if (!empty($withdetail)) { | 
                                                        
| 623 | 623 |  						if (!empty($object->timespent_withhour)) { | 
                                                        
| 624 | -							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date") . ': ' . dol_print_date($object->timespent_datehour)); | 
                                                        |
| 624 | +							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date").': '.dol_print_date($object->timespent_datehour)); | 
                                                        |
| 625 | 625 |  						} else { | 
                                                        
| 626 | -							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date") . ': ' . dol_print_date($object->timespent_date)); | 
                                                        |
| 626 | +							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date").': '.dol_print_date($object->timespent_date)); | 
                                                        |
| 627 | 627 | }  | 
                                                        
| 628 | -						$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Duration") . ': ' . convertSecondToTime($object->timespent_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY)); | 
                                                        |
| 628 | +						$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Duration").': '.convertSecondToTime($object->timespent_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY)); | 
                                                        |
| 629 | 629 | }  | 
                                                        
| 630 | 630 | $arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user;  | 
                                                        
| 631 | 631 | $arrayoftasks[$object->timespent_id]['fk_product'] = $object->timespent_fk_product;  | 
                                                        
@@ -703,7 +703,7 @@ discard block  | 
                                                    ||
| 703 | 703 | $arrayoftasks = array();  | 
                                                        
| 704 | 704 |  				foreach ($toselect as $key => $value) { | 
                                                        
| 705 | 705 | // Get userid, timepent  | 
                                                        
| 706 | - $object->fetchTimeSpent($value); // Call method to get list of timespent for a timespent line id (We use the utiliy method found into Task object)  | 
                                                        |
| 706 | + $object->fetchTimeSpent($value); // Call method to get list of timespent for a timespent line id (We use the utiliy method found into Task object)  | 
                                                        |
| 707 | 707 | // $object->id is now the task id  | 
                                                        
| 708 | 708 | $arrayoftasks[$object->id][(int) $object->timespent_fk_product]['timespent'] += $object->timespent_duration;  | 
                                                        
| 709 | 709 | $arrayoftasks[$object->id][(int) $object->timespent_fk_product]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm);  | 
                                                        
@@ -779,7 +779,7 @@ discard block  | 
                                                    ||
| 779 | 779 | // Add lines  | 
                                                        
| 780 | 780 | $date_start = '';  | 
                                                        
| 781 | 781 | $date_end = '';  | 
                                                        
| 782 | - $lineName = $ftask->ref . ' - ' . $ftask->label;  | 
                                                        |
| 782 | + $lineName = $ftask->ref.' - '.$ftask->label;  | 
                                                        |
| 783 | 783 | $lineid = $tmpinvoice->addline($lineName, $pu_ht_for_task, price2num($qtyhour / $prodDurationHours, 'MS'), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), 0, $date_start, $date_end, 0, 0, '', 'HT', 0, 1, -1, 0, '', 0, 0, null, $pa_ht);  | 
                                                        
| 784 | 784 |  						if ($lineid < 0) { | 
                                                        
| 785 | 785 | $error++;  | 
                                                        
@@ -789,8 +789,8 @@ discard block  | 
                                                    ||
| 789 | 789 | |
| 790 | 790 |  						if (!$error) { | 
                                                        
| 791 | 791 | // Update lineid into line of timespent  | 
                                                        
| 792 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'element_time SET invoice_line_id = ' . ((int) $lineid) . ', invoice_id = ' . ((int) $tmpinvoice->id);  | 
                                                        |
| 793 | -							$sql .= ' WHERE rowid IN (' . $db->sanitize(join(',', $toselect)) . ')'; | 
                                                        |
| 792 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'element_time SET invoice_line_id = '.((int) $lineid).', invoice_id = '.((int) $tmpinvoice->id);  | 
                                                        |
| 793 | +							$sql .= ' WHERE rowid IN ('.$db->sanitize(join(',', $toselect)).')'; | 
                                                        |
| 794 | 794 | $result = $db->query($sql);  | 
                                                        
| 795 | 795 |  							if (!$result) { | 
                                                        
| 796 | 796 | $error++;  | 
                                                        
@@ -828,12 +828,12 @@ discard block  | 
                                                    ||
| 828 | 828 |  	if (!($projectstatic->thirdparty->id > 0)) { | 
                                                        
| 829 | 829 |  		setEventMessages($langs->trans("ThirdPartyRequiredToGenerateIntervention"), null, 'errors'); | 
                                                        
| 830 | 830 |  	} else { | 
                                                        
| 831 | - include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';  | 
                                                        |
| 832 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 833 | - include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 831 | + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';  | 
                                                        |
| 832 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 833 | + include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 834 | 834 | |
| 835 | 835 | |
| 836 | - require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php';  | 
                                                        |
| 836 | + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';  | 
                                                        |
| 837 | 837 | $tmpinter = new Fichinter($db);  | 
                                                        
| 838 | 838 | $tmptimespent = new Task($db);  | 
                                                        
| 839 | 839 | $fuser = new User($db);  | 
                                                        
@@ -845,7 +845,7 @@ discard block  | 
                                                    ||
| 845 | 845 | $tmpinter->socid = $projectstatic->thirdparty->id;  | 
                                                        
| 846 | 846 |  		$tmpinter->date = dol_mktime(GETPOST('rehour', 'int'), GETPOST('remin', 'int'), GETPOST('resec', 'int'), GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); | 
                                                        
| 847 | 847 | $tmpinter->fk_project = $projectstatic->id;  | 
                                                        
| 848 | - $tmpinter->description = $projectstatic->title . (!empty($projectstatic->description) ? '-' . $projectstatic->label : '');  | 
                                                        |
| 848 | + $tmpinter->description = $projectstatic->title.(!empty($projectstatic->description) ? '-'.$projectstatic->label : '');  | 
                                                        |
| 849 | 849 | |
| 850 | 850 |  		if ($interToUse) { | 
                                                        
| 851 | 851 | $tmpinter->fetch($interToUse);  | 
                                                        
@@ -878,7 +878,7 @@ discard block  | 
                                                    ||
| 878 | 878 | $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);  | 
                                                        
| 879 | 879 | |
| 880 | 880 | // Add lines  | 
                                                        
| 881 | - $lineid = $tmpinter->addline($user, $tmpinter->id, $ftask->label . (!empty($value['note']) ? ' - ' . $value['note'] : ''), $value['date'], $value['timespent']);  | 
                                                        |
| 881 | + $lineid = $tmpinter->addline($user, $tmpinter->id, $ftask->label.(!empty($value['note']) ? ' - '.$value['note'] : ''), $value['date'], $value['timespent']);  | 
                                                        |
| 882 | 882 | }  | 
                                                        
| 883 | 883 | }  | 
                                                        
| 884 | 884 | |
@@ -909,9 +909,9 @@ discard block  | 
                                                    ||
| 909 | 909 | //$result = $projectstatic->fetch($object->fk_project);  | 
                                                        
| 910 | 910 | $arrayofselected = is_array($toselect) ? $toselect : array();  | 
                                                        
| 911 | 911 | |
| 912 | -$title = $object->ref . ' - ' . $langs->trans("TimeSpent"); | 
                                                        |
| 912 | +$title = $object->ref.' - '.$langs->trans("TimeSpent"); | 
                                                        |
| 913 | 913 |  if (!empty($withproject)) { | 
                                                        
| 914 | -	$title .= ' | ' . $langs->trans("Project") . (!empty($projectstatic->ref) ? ': ' . $projectstatic->ref : ''); | 
                                                        |
| 914 | +	$title .= ' | '.$langs->trans("Project").(!empty($projectstatic->ref) ? ': '.$projectstatic->ref : ''); | 
                                                        |
| 915 | 915 | }  | 
                                                        
| 916 | 916 | $help_url = '';  | 
                                                        
| 917 | 917 | |
@@ -960,13 +960,13 @@ discard block  | 
                                                    ||
| 960 | 960 | |
| 961 | 961 | $param = ((!empty($mode) && $mode == 'mine') ? '&mode=mine' : '');  | 
                                                        
| 962 | 962 |  			if ($search_user) { | 
                                                        
| 963 | - $param .= '&search_user=' . ((int) $search_user);  | 
                                                        |
| 963 | + $param .= '&search_user='.((int) $search_user);  | 
                                                        |
| 964 | 964 | }  | 
                                                        
| 965 | 965 |  			if ($search_month) { | 
                                                        
| 966 | - $param .= '&search_month=' . ((int) $search_month);  | 
                                                        |
| 966 | + $param .= '&search_month='.((int) $search_month);  | 
                                                        |
| 967 | 967 | }  | 
                                                        
| 968 | 968 |  			if ($search_year) { | 
                                                        
| 969 | - $param .= '&search_year=' . ((int) $search_year);  | 
                                                        |
| 969 | + $param .= '&search_year='.((int) $search_year);  | 
                                                        |
| 970 | 970 | }  | 
                                                        
| 971 | 971 | |
| 972 | 972 | // Project card  | 
                                                        
@@ -978,14 +978,14 @@ discard block  | 
                                                    ||
| 978 | 978 | $morehtmlref .= $projectstatic->title;  | 
                                                        
| 979 | 979 | // Thirdparty  | 
                                                        
| 980 | 980 |  			if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) { | 
                                                        
| 981 | - $morehtmlref .= '<br>' . $projectstatic->thirdparty->getNomUrl(1, 'project');  | 
                                                        |
| 981 | + $morehtmlref .= '<br>'.$projectstatic->thirdparty->getNomUrl(1, 'project');  | 
                                                        |
| 982 | 982 | }  | 
                                                        
| 983 | 983 | $morehtmlref .= '</div>';  | 
                                                        
| 984 | 984 | |
| 985 | 985 | // Define a complementary filter for search of next/prev ref.  | 
                                                        
| 986 | 986 |  			if (!$user->hasRight('projet', 'all', 'lire')) { | 
                                                        
| 987 | 987 | $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);  | 
                                                        
| 988 | -				$projectstatic->next_prev_filter = "rowid IN (" . $db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0') . ")"; | 
                                                        |
| 988 | +				$projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; | 
                                                        |
| 989 | 989 | }  | 
                                                        
| 990 | 990 | |
| 991 | 991 | dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);  | 
                                                        
@@ -1003,25 +1003,25 @@ discard block  | 
                                                    ||
| 1003 | 1003 | print '</td>';  | 
                                                        
| 1004 | 1004 | print '<td>';  | 
                                                        
| 1005 | 1005 |  				if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { | 
                                                        
| 1006 | -					print '<input type="checkbox" disabled name="usage_opportunity"' . (GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')) . '"> '; | 
                                                        |
| 1006 | +					print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> '; | 
                                                        |
| 1007 | 1007 |  					$htmltext = $langs->trans("ProjectFollowOpportunity"); | 
                                                        
| 1008 | 1008 |  					print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); | 
                                                        
| 1009 | 1009 | print '<br>';  | 
                                                        
| 1010 | 1010 | }  | 
                                                        
| 1011 | 1011 |  				if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { | 
                                                        
| 1012 | -					print '<input type="checkbox" disabled name="usage_task"' . (GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')) . '"> '; | 
                                                        |
| 1012 | +					print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> '; | 
                                                        |
| 1013 | 1013 |  					$htmltext = $langs->trans("ProjectFollowTasks"); | 
                                                        
| 1014 | 1014 |  					print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); | 
                                                        
| 1015 | 1015 | print '<br>';  | 
                                                        
| 1016 | 1016 | }  | 
                                                        
| 1017 | 1017 |  				if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { | 
                                                        
| 1018 | -					print '<input type="checkbox" disabled name="usage_bill_time"' . (GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')) . '"> '; | 
                                                        |
| 1018 | +					print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> '; | 
                                                        |
| 1019 | 1019 |  					$htmltext = $langs->trans("ProjectBillTimeDescription"); | 
                                                        
| 1020 | 1020 |  					print $form->textwithpicto($langs->trans("BillTime"), $htmltext); | 
                                                        
| 1021 | 1021 | print '<br>';  | 
                                                        
| 1022 | 1022 | }  | 
                                                        
| 1023 | 1023 |  				if (isModEnabled('eventorganization')) { | 
                                                        
| 1024 | -					print '<input type="checkbox" disabled name="usage_organize_event"' . (GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_organize_event ? ' checked="checked"' : '')) . '"> '; | 
                                                        |
| 1024 | +					print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_organize_event ? ' checked="checked"' : '')).'"> '; | 
                                                        |
| 1025 | 1025 |  					$htmltext = $langs->trans("EventOrganizationDescriptionLong"); | 
                                                        
| 1026 | 1026 |  					print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext); | 
                                                        
| 1027 | 1027 | }  | 
                                                        
@@ -1029,7 +1029,7 @@ discard block  | 
                                                    ||
| 1029 | 1029 | }  | 
                                                        
| 1030 | 1030 | |
| 1031 | 1031 | // Visibility  | 
                                                        
| 1032 | -			print '<tr><td class="titlefield">' . $langs->trans("Visibility") . '</td><td>'; | 
                                                        |
| 1032 | +			print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; | 
                                                        |
| 1033 | 1033 |  			if ($projectstatic->public) { | 
                                                        
| 1034 | 1034 |  				print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); | 
                                                        
| 1035 | 1035 |  				print $langs->trans('SharedProject'); | 
                                                        
@@ -1040,14 +1040,14 @@ discard block  | 
                                                    ||
| 1040 | 1040 | print '</td></tr>';  | 
                                                        
| 1041 | 1041 | |
| 1042 | 1042 | // Budget  | 
                                                        
| 1043 | -			print '<tr><td>' . $langs->trans("Budget") . '</td><td>'; | 
                                                        |
| 1043 | +			print '<tr><td>'.$langs->trans("Budget").'</td><td>'; | 
                                                        |
| 1044 | 1044 |  			if (!is_null($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount, '')) { | 
                                                        
| 1045 | - print '<span class="amount">' . price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency) . '</span>';  | 
                                                        |
| 1045 | + print '<span class="amount">'.price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency).'</span>';  | 
                                                        |
| 1046 | 1046 | }  | 
                                                        
| 1047 | 1047 | print '</td></tr>';  | 
                                                        
| 1048 | 1048 | |
| 1049 | 1049 | // Date start - end project  | 
                                                        
| 1050 | -			print '<tr><td>' . $langs->trans("Dates") . '</td><td>'; | 
                                                        |
| 1050 | +			print '<tr><td>'.$langs->trans("Dates").'</td><td>'; | 
                                                        |
| 1051 | 1051 | $start = dol_print_date($projectstatic->date_start, 'day');  | 
                                                        
| 1052 | 1052 | print($start ? $start : '?');  | 
                                                        
| 1053 | 1053 | $end = dol_print_date($projectstatic->date_end, 'day');  | 
                                                        
@@ -1062,7 +1062,7 @@ discard block  | 
                                                    ||
| 1062 | 1062 | $cols = 2;  | 
                                                        
| 1063 | 1063 | $savobject = $object;  | 
                                                        
| 1064 | 1064 | $object = $projectstatic;  | 
                                                        
| 1065 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';  | 
                                                        |
| 1065 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';  | 
                                                        |
| 1066 | 1066 | $object = $savobject;  | 
                                                        
| 1067 | 1067 | |
| 1068 | 1068 | print '</table>';  | 
                                                        
@@ -1080,7 +1080,7 @@ discard block  | 
                                                    ||
| 1080 | 1080 | |
| 1081 | 1081 | // Categories  | 
                                                        
| 1082 | 1082 |  			if (isModEnabled('categorie')) { | 
                                                        
| 1083 | -				print '<tr><td class="valignmiddle">' . $langs->trans("Categories") . '</td><td>'; | 
                                                        |
| 1083 | +				print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>'; | 
                                                        |
| 1084 | 1084 | print $form->showCategories($projectstatic->id, 'project', 1);  | 
                                                        
| 1085 | 1085 | print "</td></tr>";  | 
                                                        
| 1086 | 1086 | }  | 
                                                        
@@ -1109,12 +1109,12 @@ discard block  | 
                                                    ||
| 1109 | 1109 | |
| 1110 | 1110 |  				if (!empty($projectidforalltimes)) { | 
                                                        
| 1111 | 1111 | // We are on tab 'Time Spent' of project  | 
                                                        
| 1112 | - $backtourl = $_SERVER['PHP_SELF'] . '?projectid=' . $projectstatic->id . ($withproject ? '&withproject=1' : '');  | 
                                                        |
| 1113 | - $linktocreatetimeUrl = $_SERVER['PHP_SELF'] . '?' . ($withproject ? 'withproject=1' : '') . '&projectid=' . $projectstatic->id . '&action=createtime&token=' . newToken() . $param . '&backtopage=' . urlencode($backtourl);  | 
                                                        |
| 1112 | + $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject ? '&withproject=1' : '');  | 
                                                        |
| 1113 | + $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').'&projectid='.$projectstatic->id.'&action=createtime&token='.newToken().$param.'&backtopage='.urlencode($backtourl);  | 
                                                        |
| 1114 | 1114 |  				} else { | 
                                                        
| 1115 | 1115 | // We are on tab 'Time Spent' of task  | 
                                                        
| 1116 | - $backtourl = $_SERVER['PHP_SELF'] . '?id=' . $object->id . ($withproject ? '&withproject=1' : '');  | 
                                                        |
| 1117 | - $linktocreatetimeUrl = $_SERVER['PHP_SELF'] . '?' . ($withproject ? 'withproject=1' : '') . ($object->id > 0 ? '&id=' . $object->id : '&projectid=' . $projectstatic->id) . '&action=createtime&token=' . newToken() . $param . '&backtopage=' . urlencode($backtourl);  | 
                                                        |
| 1116 | + $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject ? '&withproject=1' : '');  | 
                                                        |
| 1117 | + $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime&token='.newToken().$param.'&backtopage='.urlencode($backtourl);  | 
                                                        |
| 1118 | 1118 | }  | 
                                                        
| 1119 | 1119 |  			} else { | 
                                                        
| 1120 | 1120 | $linktocreatetimeBtnStatus = -2;  | 
                                                        
@@ -1159,19 +1159,19 @@ discard block  | 
                                                    ||
| 1159 | 1159 |  		print dol_get_fiche_head($head, 'task_time', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition'); | 
                                                        
| 1160 | 1160 | |
| 1161 | 1161 |  		if ($action == 'deleteline') { | 
                                                        
| 1162 | -			$urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($object->id > 0 ? "id=" . $object->id : 'projectid=' . $projectstatic->id) . '&lineid=' . GETPOST("lineid", 'int') . ($withproject ? '&withproject=1' : ''); | 
                                                        |
| 1162 | +			$urlafterconfirm = $_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST("lineid", 'int').($withproject ? '&withproject=1' : ''); | 
                                                        |
| 1163 | 1163 |  			print $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); | 
                                                        
| 1164 | 1164 | }  | 
                                                        
| 1165 | 1165 | |
| 1166 | 1166 | $param = ($withproject ? '&withproject=1' : '');  | 
                                                        
| 1167 | - $param .= ($param ? '&' : '') . 'id=' . $object->id; // ID of task  | 
                                                        |
| 1168 | -		$linkback = $withproject ? '<a href="' . DOL_URL_ROOT . '/projet/tasks.php?id=' . $projectstatic->id . '">' . $langs->trans("BackToList") . '</a>' : ''; | 
                                                        |
| 1167 | + $param .= ($param ? '&' : '').'id='.$object->id; // ID of task  | 
                                                        |
| 1168 | +		$linkback = $withproject ? '<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>' : ''; | 
                                                        |
| 1169 | 1169 | |
| 1170 | 1170 |  		if (!GETPOST('withproject') || empty($projectstatic->id)) { | 
                                                        
| 1171 | 1171 | $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);  | 
                                                        
| 1172 | -			$object->next_prev_filter = "fk_projet IN (" . $db->sanitize($projectsListId) . ")"; | 
                                                        |
| 1172 | +			$object->next_prev_filter = "fk_projet IN (".$db->sanitize($projectsListId).")"; | 
                                                        |
| 1173 | 1173 |  		} else { | 
                                                        
| 1174 | - $object->next_prev_filter = "fk_projet = " . ((int) $projectstatic->id);  | 
                                                        |
| 1174 | + $object->next_prev_filter = "fk_projet = ".((int) $projectstatic->id);  | 
                                                        |
| 1175 | 1175 | }  | 
                                                        
| 1176 | 1176 | |
| 1177 | 1177 | $morehtmlref = '';  | 
                                                        
@@ -1179,12 +1179,12 @@ discard block  | 
                                                    ||
| 1179 | 1179 | // Project  | 
                                                        
| 1180 | 1180 |  		if (empty($withproject)) { | 
                                                        
| 1181 | 1181 | $morehtmlref .= '<div class="refidno">';  | 
                                                        
| 1182 | -			$morehtmlref .= $langs->trans("Project") . ': '; | 
                                                        |
| 1182 | +			$morehtmlref .= $langs->trans("Project").': '; | 
                                                        |
| 1183 | 1183 | $morehtmlref .= $projectstatic->getNomUrl(1);  | 
                                                        
| 1184 | 1184 | $morehtmlref .= '<br>';  | 
                                                        
| 1185 | 1185 | |
| 1186 | 1186 | // Third party  | 
                                                        
| 1187 | -			$morehtmlref .= $langs->trans("ThirdParty") . ': '; | 
                                                        |
| 1187 | +			$morehtmlref .= $langs->trans("ThirdParty").': '; | 
                                                        |
| 1188 | 1188 |  			if (!empty($projectstatic->thirdparty) && is_object($projectstatic->thirdparty)) { | 
                                                        
| 1189 | 1189 | $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);  | 
                                                        
| 1190 | 1190 | }  | 
                                                        
@@ -1200,7 +1200,7 @@ discard block  | 
                                                    ||
| 1200 | 1200 | print '<table class="border centpercent tableforfield">';  | 
                                                        
| 1201 | 1201 | |
| 1202 | 1202 | // Task parent  | 
                                                        
| 1203 | -		print '<tr><td>' . $langs->trans("ChildOfTask") . '</td><td>'; | 
                                                        |
| 1203 | +		print '<tr><td>'.$langs->trans("ChildOfTask").'</td><td>'; | 
                                                        |
| 1204 | 1204 |  		if ($object->fk_task_parent > 0) { | 
                                                        
| 1205 | 1205 | $tasktmp = new Task($db);  | 
                                                        
| 1206 | 1206 | $tasktmp->fetch($object->fk_task_parent);  | 
                                                        
@@ -1209,7 +1209,7 @@ discard block  | 
                                                    ||
| 1209 | 1209 | print '</td></tr>';  | 
                                                        
| 1210 | 1210 | |
| 1211 | 1211 | // Date start - Date end task  | 
                                                        
| 1212 | -		print '<tr><td class="titlefield">' . $langs->trans("DateStart") . ' - ' . $langs->trans("Deadline") . '</td><td>'; | 
                                                        |
| 1212 | +		print '<tr><td class="titlefield">'.$langs->trans("DateStart").' - '.$langs->trans("Deadline").'</td><td>'; | 
                                                        |
| 1213 | 1213 | $start = dol_print_date($object->date_start, 'dayhour');  | 
                                                        
| 1214 | 1214 | print($start ? $start : '?');  | 
                                                        
| 1215 | 1215 | $end = dol_print_date($object->date_end, 'dayhour');  | 
                                                        
@@ -1221,7 +1221,7 @@ discard block  | 
                                                    ||
| 1221 | 1221 | print '</td></tr>';  | 
                                                        
| 1222 | 1222 | |
| 1223 | 1223 | // Planned workload  | 
                                                        
| 1224 | -		print '<tr><td>' . $langs->trans("PlannedWorkload") . '</td><td>'; | 
                                                        |
| 1224 | +		print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>'; | 
                                                        |
| 1225 | 1225 |  		if ($object->planned_workload) { | 
                                                        
| 1226 | 1226 | print convertSecondToTime($object->planned_workload, 'allhourmin');  | 
                                                        
| 1227 | 1227 | }  | 
                                                        
@@ -1236,21 +1236,21 @@ discard block  | 
                                                    ||
| 1236 | 1236 | print '<table class="border tableforfield centpercent">';  | 
                                                        
| 1237 | 1237 | |
| 1238 | 1238 | // Progress declared  | 
                                                        
| 1239 | -		print '<tr><td class="titlefield">' . $langs->trans("ProgressDeclared") . '</td><td>'; | 
                                                        |
| 1240 | - print $object->progress != '' ? $object->progress . ' %' : '';  | 
                                                        |
| 1239 | +		print '<tr><td class="titlefield">'.$langs->trans("ProgressDeclared").'</td><td>'; | 
                                                        |
| 1240 | + print $object->progress != '' ? $object->progress.' %' : '';  | 
                                                        |
| 1241 | 1241 | print '</td></tr>';  | 
                                                        
| 1242 | 1242 | |
| 1243 | 1243 | // Progress calculated  | 
                                                        
| 1244 | -		print '<tr><td>' . $langs->trans("ProgressCalculated") . '</td><td>'; | 
                                                        |
| 1244 | +		print '<tr><td>'.$langs->trans("ProgressCalculated").'</td><td>'; | 
                                                        |
| 1245 | 1245 |  		if ($object->planned_workload) { | 
                                                        
| 1246 | 1246 | $tmparray = $object->getSummaryOfTimeSpent();  | 
                                                        
| 1247 | 1247 |  			if ($tmparray['total_duration'] > 0) { | 
                                                        
| 1248 | - print round($tmparray['total_duration'] / $object->planned_workload * 100, 2) . ' %';  | 
                                                        |
| 1248 | + print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %';  | 
                                                        |
| 1249 | 1249 |  			} else { | 
                                                        
| 1250 | 1250 | print '0 %';  | 
                                                        
| 1251 | 1251 | }  | 
                                                        
| 1252 | 1252 |  		} else { | 
                                                        
| 1253 | -			print '<span class="opacitymedium">' . $langs->trans("WorkloadNotDefined") . '</span>'; | 
                                                        |
| 1253 | +			print '<span class="opacitymedium">'.$langs->trans("WorkloadNotDefined").'</span>'; | 
                                                        |
| 1254 | 1254 | }  | 
                                                        
| 1255 | 1255 | print '</td>';  | 
                                                        
| 1256 | 1256 | |
@@ -1266,7 +1266,7 @@ discard block  | 
                                                    ||
| 1266 | 1266 | print dol_get_fiche_end();  | 
                                                        
| 1267 | 1267 |  	} else { | 
                                                        
| 1268 | 1268 |  		if ($action == 'deleteline') { | 
                                                        
| 1269 | -			$urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($object->id > 0 ? "id=" . $object->id : 'projectid=' . $projectstatic->id) . '&lineid=' . GETPOST("lineid", 'int') . ($withproject ? '&withproject=1' : ''); | 
                                                        |
| 1269 | +			$urlafterconfirm = $_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST("lineid", 'int').($withproject ? '&withproject=1' : ''); | 
                                                        |
| 1270 | 1270 |  			print $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); | 
                                                        
| 1271 | 1271 | }  | 
                                                        
| 1272 | 1272 | }  | 
                                                        
@@ -1280,7 +1280,7 @@ discard block  | 
                                                    ||
| 1280 | 1280 | |
| 1281 | 1281 |  		if ($action == 'deleteline' && !empty($projectidforalltimes)) { | 
                                                        
| 1282 | 1282 | // We must use projectidprojectid if on list of timespent of project and id=taskid if on list of timespent of a task  | 
                                                        
| 1283 | -			$urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($projectstatic->id > 0 ? 'projectid=' . $projectstatic->id : ($object->id > 0 ? "id=" . $object->id : '')) . '&lineid=' . GETPOST('lineid', 'int') . ($withproject ? '&withproject=1' : '') . "&contextpage=" . urlencode($contextpage); | 
                                                        |
| 1283 | +			$urlafterconfirm = $_SERVER["PHP_SELF"]."?".($projectstatic->id > 0 ? 'projectid='.$projectstatic->id : ($object->id > 0 ? "id=".$object->id : '')).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : '')."&contextpage=".urlencode($contextpage); | 
                                                        |
| 1284 | 1284 |  			$formconfirm = $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); | 
                                                        
| 1285 | 1285 | }  | 
                                                        
| 1286 | 1286 | |
@@ -1300,76 +1300,76 @@ discard block  | 
                                                    ||
| 1300 | 1300 | |
| 1301 | 1301 | $param = '';  | 
                                                        
| 1302 | 1302 |  		if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { | 
                                                        
| 1303 | - $param .= '&contextpage=' . urlencode($contextpage);  | 
                                                        |
| 1303 | + $param .= '&contextpage='.urlencode($contextpage);  | 
                                                        |
| 1304 | 1304 | }  | 
                                                        
| 1305 | 1305 |  		if ($limit > 0 && $limit != $conf->liste_limit) { | 
                                                        
| 1306 | 1306 | $param .= '&limit='.((int) $limit);  | 
                                                        
| 1307 | 1307 | }  | 
                                                        
| 1308 | 1308 |  		if ($search_month > 0) { | 
                                                        
| 1309 | - $param .= '&search_month=' . urlencode($search_month);  | 
                                                        |
| 1309 | + $param .= '&search_month='.urlencode($search_month);  | 
                                                        |
| 1310 | 1310 | }  | 
                                                        
| 1311 | 1311 |  		if ($search_year > 0) { | 
                                                        
| 1312 | - $param .= '&search_year=' . urlencode($search_year);  | 
                                                        |
| 1312 | + $param .= '&search_year='.urlencode($search_year);  | 
                                                        |
| 1313 | 1313 | }  | 
                                                        
| 1314 | 1314 |  		if (!empty($search_user)) { 	// We keep param if -1 because default value is forced to user id if not set | 
                                                        
| 1315 | 1315 | $param .= '&search_user='.urlencode($search_user);  | 
                                                        
| 1316 | 1316 | }  | 
                                                        
| 1317 | 1317 |  		if ($search_task_ref != '') { | 
                                                        
| 1318 | - $param .= '&search_task_ref=' . urlencode($search_task_ref);  | 
                                                        |
| 1318 | + $param .= '&search_task_ref='.urlencode($search_task_ref);  | 
                                                        |
| 1319 | 1319 | }  | 
                                                        
| 1320 | 1320 |  		if ($search_company != '') { | 
                                                        
| 1321 | - $param .= '&$search_company=' . urlencode($search_company);  | 
                                                        |
| 1321 | + $param .= '&$search_company='.urlencode($search_company);  | 
                                                        |
| 1322 | 1322 | }  | 
                                                        
| 1323 | 1323 |  		if ($search_company_alias != '') { | 
                                                        
| 1324 | - $param .= '&$search_company_alias=' . urlencode($search_company_alias);  | 
                                                        |
| 1324 | + $param .= '&$search_company_alias='.urlencode($search_company_alias);  | 
                                                        |
| 1325 | 1325 | }  | 
                                                        
| 1326 | 1326 |  		if ($search_project_ref != '') { | 
                                                        
| 1327 | - $param .= '&$search_project_ref=' . urlencode($search_project_ref);  | 
                                                        |
| 1327 | + $param .= '&$search_project_ref='.urlencode($search_project_ref);  | 
                                                        |
| 1328 | 1328 | }  | 
                                                        
| 1329 | 1329 |  		if ($search_project_label != '') { | 
                                                        
| 1330 | - $param .= '&$search_project_label=' . urlencode($search_project_label);  | 
                                                        |
| 1330 | + $param .= '&$search_project_label='.urlencode($search_project_label);  | 
                                                        |
| 1331 | 1331 | }  | 
                                                        
| 1332 | 1332 |  		if ($search_task_label != '') { | 
                                                        
| 1333 | - $param .= '&search_task_label=' . urlencode($search_task_label);  | 
                                                        |
| 1333 | + $param .= '&search_task_label='.urlencode($search_task_label);  | 
                                                        |
| 1334 | 1334 | }  | 
                                                        
| 1335 | 1335 |  		if ($search_note != '') { | 
                                                        
| 1336 | - $param .= '&search_note=' . urlencode($search_note);  | 
                                                        |
| 1336 | + $param .= '&search_note='.urlencode($search_note);  | 
                                                        |
| 1337 | 1337 | }  | 
                                                        
| 1338 | 1338 |  		if ($search_duration != '') { | 
                                                        
| 1339 | - $param .= '&search_field2=' . urlencode($search_duration);  | 
                                                        |
| 1339 | + $param .= '&search_field2='.urlencode($search_duration);  | 
                                                        |
| 1340 | 1340 | }  | 
                                                        
| 1341 | 1341 |  		if ($optioncss != '') { | 
                                                        
| 1342 | - $param .= '&optioncss=' . urlencode($optioncss);  | 
                                                        |
| 1342 | + $param .= '&optioncss='.urlencode($optioncss);  | 
                                                        |
| 1343 | 1343 | }  | 
                                                        
| 1344 | 1344 |  		if ($search_date_startday) { | 
                                                        
| 1345 | - $param .= '&search_date_startday=' . urlencode($search_date_startday);  | 
                                                        |
| 1345 | + $param .= '&search_date_startday='.urlencode($search_date_startday);  | 
                                                        |
| 1346 | 1346 | }  | 
                                                        
| 1347 | 1347 |  		if ($search_date_startmonth) { | 
                                                        
| 1348 | - $param .= '&search_date_startmonth=' . urlencode($search_date_startmonth);  | 
                                                        |
| 1348 | + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);  | 
                                                        |
| 1349 | 1349 | }  | 
                                                        
| 1350 | 1350 |  		if ($search_date_startyear) { | 
                                                        
| 1351 | - $param .= '&search_date_startyear=' . urlencode($search_date_startyear);  | 
                                                        |
| 1351 | + $param .= '&search_date_startyear='.urlencode($search_date_startyear);  | 
                                                        |
| 1352 | 1352 | }  | 
                                                        
| 1353 | 1353 |  		if ($search_date_endday) { | 
                                                        
| 1354 | - $param .= '&search_date_endday=' . urlencode($search_date_endday);  | 
                                                        |
| 1354 | + $param .= '&search_date_endday='.urlencode($search_date_endday);  | 
                                                        |
| 1355 | 1355 | }  | 
                                                        
| 1356 | 1356 |  		if ($search_date_endmonth) { | 
                                                        
| 1357 | - $param .= '&search_date_endmonth=' . urlencode($search_date_endmonth);  | 
                                                        |
| 1357 | + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);  | 
                                                        |
| 1358 | 1358 | }  | 
                                                        
| 1359 | 1359 |  		if ($search_date_endyear) { | 
                                                        
| 1360 | - $param .= '&search_date_endyear=' . urlencode($search_date_endyear);  | 
                                                        |
| 1360 | + $param .= '&search_date_endyear='.urlencode($search_date_endyear);  | 
                                                        |
| 1361 | 1361 | }  | 
                                                        
| 1362 | 1362 |  		if ($search_timespent_starthour) { | 
                                                        
| 1363 | - $param .= '&search_timespent_duration_starthour=' . urlencode($search_timespent_starthour);  | 
                                                        |
| 1363 | + $param .= '&search_timespent_duration_starthour='.urlencode($search_timespent_starthour);  | 
                                                        |
| 1364 | 1364 | }  | 
                                                        
| 1365 | 1365 |  		if ($search_timespent_startmin) { | 
                                                        
| 1366 | - $param .= '&search_timespent_duration_startmin=' . urlencode($search_timespent_startmin);  | 
                                                        |
| 1366 | + $param .= '&search_timespent_duration_startmin='.urlencode($search_timespent_startmin);  | 
                                                        |
| 1367 | 1367 | }  | 
                                                        
| 1368 | 1368 |  		if ($search_timespent_endhour) { | 
                                                        
| 1369 | - $param .= '&search_timespent_duration_endhour=' . urlencode($search_timespent_endhour);  | 
                                                        |
| 1369 | + $param .= '&search_timespent_duration_endhour='.urlencode($search_timespent_endhour);  | 
                                                        |
| 1370 | 1370 | }  | 
                                                        
| 1371 | 1371 |  		if ($search_timespent_endmin) { | 
                                                        
| 1372 | - $param .= '&search_timespent_duration_endmin=' . urlencode($search_timespent_endmin);  | 
                                                        |
| 1372 | + $param .= '&search_timespent_duration_endmin='.urlencode($search_timespent_endmin);  | 
                                                        |
| 1373 | 1373 | }  | 
                                                        
| 1374 | 1374 | |
| 1375 | 1375 | /*  | 
                                                        
@@ -1377,24 +1377,24 @@ discard block  | 
                                                    ||
| 1377 | 1377 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';  | 
                                                        
| 1378 | 1378 | */  | 
                                                        
| 1379 | 1379 |  		if ($id) { | 
                                                        
| 1380 | - $param .= '&id=' . urlencode($id);  | 
                                                        |
| 1380 | + $param .= '&id='.urlencode($id);  | 
                                                        |
| 1381 | 1381 | }  | 
                                                        
| 1382 | 1382 |  		if ($projectid) { | 
                                                        
| 1383 | - $param .= '&projectid=' . urlencode($projectid);  | 
                                                        |
| 1383 | + $param .= '&projectid='.urlencode($projectid);  | 
                                                        |
| 1384 | 1384 | }  | 
                                                        
| 1385 | 1385 |  		if ($withproject) { | 
                                                        
| 1386 | - $param .= '&withproject=' . urlencode($withproject);  | 
                                                        |
| 1386 | + $param .= '&withproject='.urlencode($withproject);  | 
                                                        |
| 1387 | 1387 | }  | 
                                                        
| 1388 | 1388 | // Add $param from hooks  | 
                                                        
| 1389 | 1389 | $parameters = array();  | 
                                                        
| 1390 | 1390 |  		$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook | 
                                                        
| 1391 | 1391 | $param .= $hookmanager->resPrint;  | 
                                                        
| 1392 | 1392 | |
| 1393 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';  | 
                                                        |
| 1393 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';  | 
                                                        |
| 1394 | 1394 |  		if ($optioncss != '') { | 
                                                        
| 1395 | - print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';  | 
                                                        |
| 1395 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';  | 
                                                        |
| 1396 | 1396 | }  | 
                                                        
| 1397 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 1397 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 1398 | 1398 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';  | 
                                                        
| 1399 | 1399 |  		if ($action == 'editline') { | 
                                                        
| 1400 | 1400 | print '<input type="hidden" name="action" value="updateline">';  | 
                                                        
@@ -1409,13 +1409,13 @@ discard block  | 
                                                    ||
| 1409 | 1409 |  		} else { | 
                                                        
| 1410 | 1410 | print '<input type="hidden" name="action" value="list">';  | 
                                                        
| 1411 | 1411 | }  | 
                                                        
| 1412 | - print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';  | 
                                                        |
| 1413 | - print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';  | 
                                                        |
| 1412 | + print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';  | 
                                                        |
| 1413 | + print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';  | 
                                                        |
| 1414 | 1414 | |
| 1415 | - print '<input type="hidden" name="id" value="' . $id . '">';  | 
                                                        |
| 1416 | - print '<input type="hidden" name="projectid" value="' . $projectidforalltimes . '">';  | 
                                                        |
| 1417 | - print '<input type="hidden" name="withproject" value="' . $withproject . '">';  | 
                                                        |
| 1418 | - print '<input type="hidden" name="tab" value="' . $tab . '">';  | 
                                                        |
| 1415 | + print '<input type="hidden" name="id" value="'.$id.'">';  | 
                                                        |
| 1416 | + print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">';  | 
                                                        |
| 1417 | + print '<input type="hidden" name="withproject" value="'.$withproject.'">';  | 
                                                        |
| 1418 | + print '<input type="hidden" name="tab" value="'.$tab.'">';  | 
                                                        |
| 1419 | 1419 | print '<input type="hidden" name="page_y" value="">';  | 
                                                        
| 1420 | 1420 | |
| 1421 | 1421 | // Form to convert time spent into invoice  | 
                                                        
@@ -1442,7 +1442,7 @@ discard block  | 
                                                    ||
| 1442 | 1442 | 'onelineperperiod' => 'OneLinePerTimeSpentLine',  | 
                                                        
| 1443 | 1443 | );  | 
                                                        
| 1444 | 1444 |  				print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1); | 
                                                        
| 1445 | - print "\n" . '<script type="text/javascript">';  | 
                                                        |
| 1445 | + print "\n".'<script type="text/javascript">';  | 
                                                        |
| 1446 | 1446 | print '  | 
                                                        
| 1447 | 1447 |  				$(document).ready(function () { | 
                                                        
| 1448 | 1448 | setDetailVisibility();  | 
                                                        
@@ -1459,8 +1459,8 @@ discard block  | 
                                                    ||
| 1459 | 1459 | }  | 
                                                        
| 1460 | 1460 | });  | 
                                                        
| 1461 | 1461 | ';  | 
                                                        
| 1462 | - print '</script>' . "\n";  | 
                                                        |
| 1463 | -				print '<span style="display:none" id="detail_time_duration"><input type="checkbox" value="detail" name="detail_time_duration"/>' . $langs->trans('AddDetailDateAndDuration') . '</span>'; | 
                                                        |
| 1462 | + print '</script>'."\n";  | 
                                                        |
| 1463 | +				print '<span style="display:none" id="detail_time_duration"><input type="checkbox" value="detail" name="detail_time_duration"/>'.$langs->trans('AddDetailDateAndDuration').'</span>'; | 
                                                        |
| 1464 | 1464 | print '</td>';  | 
                                                        
| 1465 | 1465 | print '</tr>';  | 
                                                        
| 1466 | 1466 | |
@@ -1495,14 +1495,14 @@ discard block  | 
                                                    ||
| 1495 | 1495 | |
| 1496 | 1496 | print '<br>';  | 
                                                        
| 1497 | 1497 | print '<div class="center">';  | 
                                                        
| 1498 | -				print '<input type="submit" class="button" id="createbills" name="createbills" value="' . $langs->trans('GenerateBill') . '">  '; | 
                                                        |
| 1499 | -				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '">'; | 
                                                        |
| 1498 | +				print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('GenerateBill').'">  '; | 
                                                        |
| 1499 | +				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; | 
                                                        |
| 1500 | 1500 | print '</div>';  | 
                                                        
| 1501 | 1501 | print '<br>';  | 
                                                        
| 1502 | 1502 |  			} else { | 
                                                        
| 1503 | -				print '<div class="warning">' . $langs->trans("ThirdPartyRequiredToGenerateInvoice") . '</div>'; | 
                                                        |
| 1503 | +				print '<div class="warning">'.$langs->trans("ThirdPartyRequiredToGenerateInvoice").'</div>'; | 
                                                        |
| 1504 | 1504 | print '<div class="center">';  | 
                                                        
| 1505 | -				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '">'; | 
                                                        |
| 1505 | +				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; | 
                                                        |
| 1506 | 1506 | print '</div>';  | 
                                                        
| 1507 | 1507 | $massaction = '';  | 
                                                        
| 1508 | 1508 | }  | 
                                                        
@@ -1515,7 +1515,7 @@ discard block  | 
                                                    ||
| 1515 | 1515 | print '<table class="noborder centpercent">';  | 
                                                        
| 1516 | 1516 | print '<tr>';  | 
                                                        
| 1517 | 1517 | print '<td class="titlefield">';  | 
                                                        
| 1518 | -				print img_picto('', 'intervention', 'class="pictofixedwidth"') . $langs->trans('InterToUse'); | 
                                                        |
| 1518 | +				print img_picto('', 'intervention', 'class="pictofixedwidth"').$langs->trans('InterToUse'); | 
                                                        |
| 1519 | 1519 | print '</td>';  | 
                                                        
| 1520 | 1520 | print '<td>';  | 
                                                        
| 1521 | 1521 | $forminter = new FormIntervention($db);  | 
                                                        
@@ -1525,14 +1525,14 @@ discard block  | 
                                                    ||
| 1525 | 1525 | print '</table>';  | 
                                                        
| 1526 | 1526 | |
| 1527 | 1527 | print '<div class="center">';  | 
                                                        
| 1528 | -				print '<input type="submit" class="button" id="createinter" name="createinter" value="' . $langs->trans('GenerateInter') . '">  '; | 
                                                        |
| 1529 | -				print '<input type="submit" class="button" id="cancel" name="cancel" value="' . $langs->trans('Cancel') . '">'; | 
                                                        |
| 1528 | +				print '<input type="submit" class="button" id="createinter" name="createinter" value="'.$langs->trans('GenerateInter').'">  '; | 
                                                        |
| 1529 | +				print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">'; | 
                                                        |
| 1530 | 1530 | print '</div>';  | 
                                                        
| 1531 | 1531 | print '<br>';  | 
                                                        
| 1532 | 1532 |  			} else { | 
                                                        
| 1533 | -				print '<div class="warning">' . $langs->trans("ThirdPartyRequiredToGenerateIntervention") . '</div>'; | 
                                                        |
| 1533 | +				print '<div class="warning">'.$langs->trans("ThirdPartyRequiredToGenerateIntervention").'</div>'; | 
                                                        |
| 1534 | 1534 | print '<div class="center">';  | 
                                                        
| 1535 | -				print '<input type="submit" class="button" id="cancel" name="cancel" value="' . $langs->trans('Cancel') . '">'; | 
                                                        |
| 1535 | +				print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">'; | 
                                                        |
| 1536 | 1536 | print '</div>';  | 
                                                        
| 1537 | 1537 | $massaction = '';  | 
                                                        
| 1538 | 1538 | }  | 
                                                        
@@ -1594,14 +1594,14 @@ discard block  | 
                                                    ||
| 1594 | 1594 | $sql .= " AND t.fk_element =".((int) $object->id);  | 
                                                        
| 1595 | 1595 |  		} elseif (!empty($projectidforalltimes)) { | 
                                                        
| 1596 | 1596 | // Limit on one project  | 
                                                        
| 1597 | -			$sql .= " AND pt.fk_projet IN (" . $db->sanitize($projectidforalltimes) . ")"; | 
                                                        |
| 1597 | +			$sql .= " AND pt.fk_projet IN (".$db->sanitize($projectidforalltimes).")"; | 
                                                        |
| 1598 | 1598 |  		} elseif (!empty($allprojectforuser)) { | 
                                                        
| 1599 | 1599 | // Limit on on user  | 
                                                        
| 1600 | 1600 |  			if (empty($search_user)) { | 
                                                        
| 1601 | 1601 | $search_user = $user->id;  | 
                                                        
| 1602 | 1602 | }  | 
                                                        
| 1603 | 1603 |  			if ($search_user > 0) { | 
                                                        
| 1604 | - $sql .= " AND t.fk_user = " . ((int) $search_user);  | 
                                                        |
| 1604 | + $sql .= " AND t.fk_user = ".((int) $search_user);  | 
                                                        |
| 1605 | 1605 | }  | 
                                                        
| 1606 | 1606 | }  | 
                                                        
| 1607 | 1607 | |
@@ -1654,13 +1654,13 @@ discard block  | 
                                                    ||
| 1654 | 1654 |  			if ($search_timespent_starthour || $search_timespent_startmin) { | 
                                                        
| 1655 | 1655 | $timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds  | 
                                                        
| 1656 | 1656 | $timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds  | 
                                                        
| 1657 | - $sql .= " AND t.element_duration >= " . $timespent_duration_start;  | 
                                                        |
| 1657 | + $sql .= " AND t.element_duration >= ".$timespent_duration_start;  | 
                                                        |
| 1658 | 1658 | }  | 
                                                        
| 1659 | 1659 | |
| 1660 | 1660 |  			if ($search_timespent_endhour || $search_timespent_endmin) { | 
                                                        
| 1661 | 1661 | $timespent_duration_end = $search_timespent_endhour * 60 * 60; // We store duration in seconds  | 
                                                        
| 1662 | 1662 | $timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds  | 
                                                        
| 1663 | - $sql .= " AND t.element_duration <= " . $timespent_duration_end;  | 
                                                        |
| 1663 | + $sql .= " AND t.element_duration <= ".$timespent_duration_end;  | 
                                                        |
| 1664 | 1664 | }  | 
                                                        
| 1665 | 1665 | }  | 
                                                        
| 1666 | 1666 | |
@@ -1708,13 +1708,13 @@ discard block  | 
                                                    ||
| 1708 | 1708 | |
| 1709 | 1709 |  		if ($num >= 0) { | 
                                                        
| 1710 | 1710 |  			if (!empty($projectidforalltimes)) { | 
                                                        
| 1711 | - print '<!-- List of time spent for project -->' . "\n";  | 
                                                        |
| 1711 | + print '<!-- List of time spent for project -->'."\n";  | 
                                                        |
| 1712 | 1712 | |
| 1713 | 1713 |  				$title = $langs->trans("ListTaskTimeUserProject"); | 
                                                        
| 1714 | 1714 | |
| 1715 | 1715 | print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'clock', 0, $linktocreatetime, '', $limit, 0, 0, 1);  | 
                                                        
| 1716 | 1716 |  			} else { | 
                                                        
| 1717 | - print '<!-- List of time spent -->' . "\n";  | 
                                                        |
| 1717 | + print '<!-- List of time spent -->'."\n";  | 
                                                        |
| 1718 | 1718 | |
| 1719 | 1719 |  				$title = $langs->trans("ListTaskTimeForTask"); | 
                                                        
| 1720 | 1720 | |
@@ -1736,26 +1736,26 @@ discard block  | 
                                                    ||
| 1736 | 1736 | * Form to add a new line of time spent  | 
                                                        
| 1737 | 1737 | */  | 
                                                        
| 1738 | 1738 |  		if ($action == 'createtime' && $user->hasRight('projet', 'time')) { | 
                                                        
| 1739 | - print '<!-- table to add time spent -->' . "\n";  | 
                                                        |
| 1739 | + print '<!-- table to add time spent -->'."\n";  | 
                                                        |
| 1740 | 1740 |  			if (!empty($id)) { | 
                                                        
| 1741 | - print '<input type="hidden" name="taskid" value="' . $id . '">';  | 
                                                        |
| 1741 | + print '<input type="hidden" name="taskid" value="'.$id.'">';  | 
                                                        |
| 1742 | 1742 | }  | 
                                                        
| 1743 | 1743 | |
| 1744 | 1744 | print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table  | 
                                                        
| 1745 | 1745 | print '<table class="noborder nohover centpercent">';  | 
                                                        
| 1746 | 1746 | |
| 1747 | 1747 | print '<tr class="liste_titre">';  | 
                                                        
| 1748 | -			print '<td>' . $langs->trans("Date") . '</td>'; | 
                                                        |
| 1748 | +			print '<td>'.$langs->trans("Date").'</td>'; | 
                                                        |
| 1749 | 1749 |  			if (!empty($allprojectforuser)) { | 
                                                        
| 1750 | -				print '<td>' . $langs->trans("Project") . '</td>'; | 
                                                        |
| 1750 | +				print '<td>'.$langs->trans("Project").'</td>'; | 
                                                        |
| 1751 | 1751 | }  | 
                                                        
| 1752 | 1752 |  			if (empty($id)) { | 
                                                        
| 1753 | -				print '<td>' . $langs->trans("Task") . '</td>'; | 
                                                        |
| 1753 | +				print '<td>'.$langs->trans("Task").'</td>'; | 
                                                        |
| 1754 | 1754 | }  | 
                                                        
| 1755 | -			print '<td>' . $langs->trans("By") . '</td>'; | 
                                                        |
| 1756 | -			print '<td>' . $langs->trans("Note") . '</td>'; | 
                                                        |
| 1757 | -			print '<td>' . $langs->trans("NewTimeSpent") . '</td>'; | 
                                                        |
| 1758 | -			print '<td>' . $langs->trans("ProgressDeclared") . '</td>'; | 
                                                        |
| 1755 | +			print '<td>'.$langs->trans("By").'</td>'; | 
                                                        |
| 1756 | +			print '<td>'.$langs->trans("Note").'</td>'; | 
                                                        |
| 1757 | +			print '<td>'.$langs->trans("NewTimeSpent").'</td>'; | 
                                                        |
| 1758 | +			print '<td>'.$langs->trans("ProgressDeclared").'</td>'; | 
                                                        |
| 1759 | 1759 |  			if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { | 
                                                        
| 1760 | 1760 | print '<td></td>';  | 
                                                        
| 1761 | 1761 | |
@@ -1809,14 +1809,14 @@ discard block  | 
                                                    ||
| 1809 | 1809 |  				print $form->select_dolusers((GETPOST('userid', 'int') ? GETPOST('userid', 'int') : $userid), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'minwidth150imp maxwidth200'); | 
                                                        
| 1810 | 1810 |  			} else { | 
                                                        
| 1811 | 1811 |  				if ($nboftasks) { | 
                                                        
| 1812 | -					print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . ' ' . $langs->trans('FirstAddRessourceToAllocateTime'); | 
                                                        |
| 1812 | +					print img_error($langs->trans('FirstAddRessourceToAllocateTime')).' '.$langs->trans('FirstAddRessourceToAllocateTime'); | 
                                                        |
| 1813 | 1813 | }  | 
                                                        
| 1814 | 1814 | }  | 
                                                        
| 1815 | 1815 | print '</td>';  | 
                                                        
| 1816 | 1816 | |
| 1817 | 1817 | // Note  | 
                                                        
| 1818 | 1818 | print '<td>';  | 
                                                        
| 1819 | -			print '<textarea name="timespent_note" class="maxwidth100onsmartphone" rows="' . ROWS_2 . '">' . (GETPOST('timespent_note') ? GETPOST('timespent_note') : '') . '</textarea>'; | 
                                                        |
| 1819 | +			print '<textarea name="timespent_note" class="maxwidth100onsmartphone" rows="'.ROWS_2.'">'.(GETPOST('timespent_note') ? GETPOST('timespent_note') : '').'</textarea>'; | 
                                                        |
| 1820 | 1820 | print '</td>';  | 
                                                        
| 1821 | 1821 | |
| 1822 | 1822 | // Duration - Time spent  | 
                                                        
@@ -1884,7 +1884,7 @@ discard block  | 
                                                    ||
| 1884 | 1884 |  		$selectedfields .= (is_array($arrayofmassactions) && count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); | 
                                                        
| 1885 | 1885 | |
| 1886 | 1886 | print '<div class="div-table-responsive">';  | 
                                                        
| 1887 | - print '<table class="tagtable nobottomiftotal liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n";  | 
                                                        |
| 1887 | + print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";  | 
                                                        |
| 1888 | 1888 | |
| 1889 | 1889 | // Fields title search  | 
                                                        
| 1890 | 1890 | // --------------------------------------------------------------------  | 
                                                        
@@ -1909,20 +1909,20 @@ discard block  | 
                                                    ||
| 1909 | 1909 | }  | 
                                                        
| 1910 | 1910 | // Thirdparty  | 
                                                        
| 1911 | 1911 |  		if (!empty($arrayfields['p.fk_soc']['checked'])) { | 
                                                        
| 1912 | - print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company" value="' . dol_escape_htmltag($search_company) . '"></td>';  | 
                                                        |
| 1912 | + print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company" value="'.dol_escape_htmltag($search_company).'"></td>';  | 
                                                        |
| 1913 | 1913 | }  | 
                                                        
| 1914 | 1914 | |
| 1915 | 1915 | // Thirdparty alias  | 
                                                        
| 1916 | 1916 |  		if (!empty($arrayfields['s.name_alias']['checked'])) { | 
                                                        
| 1917 | - print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company_alias" value="' . dol_escape_htmltag($search_company_alias) . '"></td>';  | 
                                                        |
| 1917 | + print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company_alias" value="'.dol_escape_htmltag($search_company_alias).'"></td>';  | 
                                                        |
| 1918 | 1918 | }  | 
                                                        
| 1919 | 1919 | |
| 1920 | 1920 |  		if (!empty($allprojectforuser)) { | 
                                                        
| 1921 | 1921 |  			if (!empty($arrayfields['p.project_ref']['checked'])) { | 
                                                        
| 1922 | - print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_ref" value="' . dol_escape_htmltag($search_project_ref) . '"></td>';  | 
                                                        |
| 1922 | + print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';  | 
                                                        |
| 1923 | 1923 | }  | 
                                                        
| 1924 | 1924 |  			if (!empty($arrayfields['p.project_label']['checked'])) { | 
                                                        
| 1925 | - print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_label" value="' . dol_escape_htmltag($search_project_label) . '"></td>';  | 
                                                        |
| 1925 | + print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_project_label" value="'.dol_escape_htmltag($search_project_label).'"></td>';  | 
                                                        |
| 1926 | 1926 | }  | 
                                                        
| 1927 | 1927 | }  | 
                                                        
| 1928 | 1928 | // Task  | 
                                                        
@@ -1940,7 +1940,7 @@ discard block  | 
                                                    ||
| 1940 | 1940 | }  | 
                                                        
| 1941 | 1941 | // Note  | 
                                                        
| 1942 | 1942 |  		if (!empty($arrayfields['t.note']['checked'])) { | 
                                                        
| 1943 | - print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_note" value="' . dol_escape_htmltag($search_note) . '"></td>';  | 
                                                        |
| 1943 | + print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_note" value="'.dol_escape_htmltag($search_note).'"></td>';  | 
                                                        |
| 1944 | 1944 | }  | 
                                                        
| 1945 | 1945 | // Duration  | 
                                                        
| 1946 | 1946 |  		if (!empty($arrayfields['t.element_duration']['checked'])) { | 
                                                        
@@ -1951,7 +1951,7 @@ discard block  | 
                                                    ||
| 1951 | 1951 |  			if ($search_timespent_starthour || $search_timespent_startmin) { | 
                                                        
| 1952 | 1952 | $durationtouse_start = ($search_timespent_starthour * 3600 + $search_timespent_startmin * 60);  | 
                                                        
| 1953 | 1953 | }  | 
                                                        
| 1954 | -			print '<div class="nowraponall">' . $langs->trans('from') . ' '; | 
                                                        |
| 1954 | +			print '<div class="nowraponall">'.$langs->trans('from').' '; | 
                                                        |
| 1955 | 1955 |  			print $form->select_duration('search_timespent_duration_start', $durationtouse_start, 0, 'text', 0, 1); | 
                                                        
| 1956 | 1956 | print '</div>';  | 
                                                        
| 1957 | 1957 | |
@@ -1959,7 +1959,7 @@ discard block  | 
                                                    ||
| 1959 | 1959 |  			if ($search_timespent_endhour || $search_timespent_endmin) { | 
                                                        
| 1960 | 1960 | $durationtouse_end = ($search_timespent_endhour * 3600 + $search_timespent_endmin * 60);  | 
                                                        
| 1961 | 1961 | }  | 
                                                        
| 1962 | -			print '<div class="nowraponall">' . $langs->trans('at') . ' '; | 
                                                        |
| 1962 | +			print '<div class="nowraponall">'.$langs->trans('at').' '; | 
                                                        |
| 1963 | 1963 |  			print $form->select_duration('search_timespent_duration_end', $durationtouse_end, 0, 'text', 0, 1); | 
                                                        
| 1964 | 1964 | print '</div>';  | 
                                                        
| 1965 | 1965 | |
@@ -1975,7 +1975,7 @@ discard block  | 
                                                    ||
| 1975 | 1975 | }  | 
                                                        
| 1976 | 1976 | // Value billed  | 
                                                        
| 1977 | 1977 |  		if (!empty($arrayfields['valuebilled']['checked'])) { | 
                                                        
| 1978 | -			print '<td class="liste_titre center">' . $form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1) . '</td>'; | 
                                                        |
| 1978 | +			print '<td class="liste_titre center">'.$form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1).'</td>'; | 
                                                        |
| 1979 | 1979 | }  | 
                                                        
| 1980 | 1980 | |
| 1981 | 1981 | /*  | 
                                                        
@@ -1993,7 +1993,7 @@ discard block  | 
                                                    ||
| 1993 | 1993 | print $searchpicto;  | 
                                                        
| 1994 | 1994 | print '</td>';  | 
                                                        
| 1995 | 1995 | }  | 
                                                        
| 1996 | - print '</tr>' . "\n";  | 
                                                        |
| 1996 | + print '</tr>'."\n";  | 
                                                        |
| 1997 | 1997 | |
| 1998 | 1998 | $totalarray = array();  | 
                                                        
| 1999 | 1999 | $totalarray['nbfield'] = 0;  | 
                                                        
@@ -2103,7 +2103,7 @@ discard block  | 
                                                    ||
| 2103 | 2103 |  			if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { | 
                                                        
| 2104 | 2104 | print '<td class="center nowraponall">';  | 
                                                        
| 2105 | 2105 |  				if (($action == 'editline' || $action == 'splitline') && GETPOST('lineid', 'int') == $task_time->rowid) { | 
                                                        
| 2106 | -					print '<input type="hidden" name="lineid" value="' . GETPOST('lineid', 'int') . '">'; | 
                                                        |
| 2106 | +					print '<input type="hidden" name="lineid" value="'.GETPOST('lineid', 'int').'">'; | 
                                                        |
| 2107 | 2107 |  					print '<input type="submit" class="button buttongen smallpaddingimp margintoponlyshort marginbottomonlyshort button-save" name="save" value="'.$langs->trans("Save").'">'; | 
                                                        
| 2108 | 2108 | print '<br>';  | 
                                                        
| 2109 | 2109 |  					print '<input type="submit" class="button buttongen smallpaddingimp margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; | 
                                                        
@@ -2111,7 +2111,7 @@ discard block  | 
                                                    ||
| 2111 | 2111 |  					if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) { | 
                                                        
| 2112 | 2112 |  						if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) { | 
                                                        
| 2113 | 2113 | print ' ';  | 
                                                        
| 2114 | - print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=splitline&token=' . newToken() . '&lineid=' . $task_time->rowid . $param . ((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '') . '">';  | 
                                                        |
| 2114 | + print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';  | 
                                                        |
| 2115 | 2115 |  							print img_split('', 'class="pictofixedwidth"'); | 
                                                        
| 2116 | 2116 | print '</a>';  | 
                                                        
| 2117 | 2117 | }  | 
                                                        
@@ -2130,7 +2130,7 @@ discard block  | 
                                                    ||
| 2130 | 2130 | $selected = 1;  | 
                                                        
| 2131 | 2131 | }  | 
                                                        
| 2132 | 2132 | print ' ';  | 
                                                        
| 2133 | - print '<input id="cb' . $task_time->rowid . '" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="' . $task_time->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>';  | 
                                                        |
| 2133 | + print '<input id="cb'.$task_time->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$task_time->rowid.'"'.($selected ? ' checked="checked"' : '').'>';  | 
                                                        |
| 2134 | 2134 | }  | 
                                                        
| 2135 | 2135 | }  | 
                                                        
| 2136 | 2136 | }  | 
                                                        
@@ -2248,7 +2248,7 @@ discard block  | 
                                                    ||
| 2248 | 2248 | }  | 
                                                        
| 2249 | 2249 | }  | 
                                                        
| 2250 | 2250 |  			} elseif ($action !== 'createtime') { | 
                                                        
| 2251 | - print '<input type="hidden" name="taskid" value="' . $id . '">';  | 
                                                        |
| 2251 | + print '<input type="hidden" name="taskid" value="'.$id.'">';  | 
                                                        |
| 2252 | 2252 | }  | 
                                                        
| 2253 | 2253 | |
| 2254 | 2254 | // Task label  | 
                                                        
@@ -2278,7 +2278,7 @@ discard block  | 
                                                    ||
| 2278 | 2278 |  						print img_object('', 'user', 'class="hideonsmartphone"'); | 
                                                        
| 2279 | 2279 | print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask, '0', 0, 0, '', 0, '', 'maxwidth200');  | 
                                                        
| 2280 | 2280 |  					} else { | 
                                                        
| 2281 | -						print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime'); | 
                                                        |
| 2281 | +						print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); | 
                                                        |
| 2282 | 2282 | }  | 
                                                        
| 2283 | 2283 |  				} else { | 
                                                        
| 2284 | 2284 | $userstatic->id = $task_time->fk_user;  | 
                                                        
@@ -2298,7 +2298,7 @@ discard block  | 
                                                    ||
| 2298 | 2298 |  			if (!empty($arrayfields['t.note']['checked'])) { | 
                                                        
| 2299 | 2299 |  				if ($action == 'editline' && GETPOST('lineid', 'int') == $task_time->rowid) { | 
                                                        
| 2300 | 2300 | print '<td class="small">';  | 
                                                        
| 2301 | - print '<textarea name="timespent_note_line" width="95%" rows="' . ROWS_1 . '">' . dol_escape_htmltag($task_time->note, 0, 1) . '</textarea>';  | 
                                                        |
| 2301 | + print '<textarea name="timespent_note_line" width="95%" rows="'.ROWS_1.'">'.dol_escape_htmltag($task_time->note, 0, 1).'</textarea>';  | 
                                                        |
| 2302 | 2302 | print '</td>';  | 
                                                        
| 2303 | 2303 |  				} else { | 
                                                        
| 2304 | 2304 | print '<td class="small tdoverflowmax150 classfortooltip" title="'.dol_string_onlythesehtmltags(dol_htmlentitiesbr($task_time->note)).'">';  | 
                                                        
@@ -2309,7 +2309,7 @@ discard block  | 
                                                    ||
| 2309 | 2309 | $totalarray['nbfield']++;  | 
                                                        
| 2310 | 2310 | }  | 
                                                        
| 2311 | 2311 |  			} elseif ($action == 'editline' && GETPOST('lineid', 'int') == $task_time->rowid) { | 
                                                        
| 2312 | - print '<input type="hidden" name="timespent_note_line" value="' . dol_escape_htmltag($task_time->note, 0, 1) . '">';  | 
                                                        |
| 2312 | + print '<input type="hidden" name="timespent_note_line" value="'.dol_escape_htmltag($task_time->note, 0, 1).'">';  | 
                                                        |
| 2313 | 2313 | }  | 
                                                        
| 2314 | 2314 | |
| 2315 | 2315 | // Time spent  | 
                                                        
@@ -2369,7 +2369,7 @@ discard block  | 
                                                    ||
| 2369 | 2369 | $value = price2num($task_time->thm * $task_time->element_duration / 3600, 'MT', 1);  | 
                                                        
| 2370 | 2370 | |
| 2371 | 2371 | print '<td class="nowraponall right">';  | 
                                                        
| 2372 | -				print '<span class="amount" title="' . $langs->trans("THM") . ': ' . price($task_time->thm) . '">'; | 
                                                        |
| 2372 | +				print '<span class="amount" title="'.$langs->trans("THM").': '.price($task_time->thm).'">'; | 
                                                        |
| 2373 | 2373 | print price($value, 1, $langs, 1, -1, -1, $conf->currency);  | 
                                                        
| 2374 | 2374 | print '</span>';  | 
                                                        
| 2375 | 2375 | print '</td>';  | 
                                                        
@@ -2402,7 +2402,7 @@ discard block  | 
                                                    ||
| 2402 | 2402 |  						if ($task_time->invoice_id) { | 
                                                        
| 2403 | 2403 | $result = $tmpinvoice->fetch($task_time->invoice_id);  | 
                                                        
| 2404 | 2404 |  							if ($result > 0) { | 
                                                        
| 2405 | -								if ($action=='editline' && $_GET['lineid'] == $task_time->rowid) { | 
                                                        |
| 2405 | +								if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) { | 
                                                        |
| 2406 | 2406 |  									print $formproject->selectInvoiceAndLine($task_time->invoice_id, $task_time->invoice_line_id, 'invoiceid', 'invoicelineid', 'maxwidth500', array('p.rowid'=>$projectstatic->id)); | 
                                                        
| 2407 | 2407 |  								} else { | 
                                                        
| 2408 | 2408 | print $tmpinvoice->getNomUrl(1);  | 
                                                        
@@ -2420,7 +2420,7 @@ discard block  | 
                                                    ||
| 2420 | 2420 |  							print $langs->trans("No"); | 
                                                        
| 2421 | 2421 | }  | 
                                                        
| 2422 | 2422 |  					} else { | 
                                                        
| 2423 | -						print '<span class="opacitymedium">' . $langs->trans("NA") . '</span>'; | 
                                                        |
| 2423 | +						print '<span class="opacitymedium">'.$langs->trans("NA").'</span>'; | 
                                                        |
| 2424 | 2424 | }  | 
                                                        
| 2425 | 2425 | }  | 
                                                        
| 2426 | 2426 | print '</td>';  | 
                                                        
@@ -2451,7 +2451,7 @@ discard block  | 
                                                    ||
| 2451 | 2451 |  					if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) { | 
                                                        
| 2452 | 2452 |  						if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) { | 
                                                        
| 2453 | 2453 | print ' ';  | 
                                                        
| 2454 | - print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=splitline&token=' . newToken() . '&lineid=' . $task_time->rowid . $param . ((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '') . '">';  | 
                                                        |
| 2454 | + print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';  | 
                                                        |
| 2455 | 2455 |  							print img_split('', 'class="pictofixedwidth"'); | 
                                                        
| 2456 | 2456 | print '</a>';  | 
                                                        
| 2457 | 2457 | }  | 
                                                        
@@ -2470,7 +2470,7 @@ discard block  | 
                                                    ||
| 2470 | 2470 | $selected = 1;  | 
                                                        
| 2471 | 2471 | }  | 
                                                        
| 2472 | 2472 | print ' ';  | 
                                                        
| 2473 | - print '<input id="cb' . $task_time->rowid . '" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="' . $task_time->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>';  | 
                                                        |
| 2473 | + print '<input id="cb'.$task_time->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$task_time->rowid.'"'.($selected ? ' checked="checked"' : '').'>';  | 
                                                        |
| 2474 | 2474 | }  | 
                                                        
| 2475 | 2475 | }  | 
                                                        
| 2476 | 2476 | }  | 
                                                        
@@ -2560,7 +2560,7 @@ discard block  | 
                                                    ||
| 2560 | 2560 |  							print img_object('', 'user', 'class="hideonsmartphone"'); | 
                                                        
| 2561 | 2561 | print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask);  | 
                                                        
| 2562 | 2562 |  						} else { | 
                                                        
| 2563 | -							print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime'); | 
                                                        |
| 2563 | +							print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); | 
                                                        |
| 2564 | 2564 | }  | 
                                                        
| 2565 | 2565 |  					} else { | 
                                                        
| 2566 | 2566 | $userstatic->id = $task_time->fk_user;  | 
                                                        
@@ -2577,13 +2577,13 @@ discard block  | 
                                                    ||
| 2577 | 2577 |  				if (!empty($arrayfields['t.note']['checked'])) { | 
                                                        
| 2578 | 2578 | print '<td class="tdoverflowmax300">';  | 
                                                        
| 2579 | 2579 |  					if ($action == 'splitline' && GETPOST('lineid', 'int') == $task_time->rowid) { | 
                                                        
| 2580 | - print '<textarea name="timespent_note_line" width="95%" rows="' . ROWS_1 . '">' . dol_escape_htmltag($task_time->note, 0, 1) . '</textarea>';  | 
                                                        |
| 2580 | + print '<textarea name="timespent_note_line" width="95%" rows="'.ROWS_1.'">'.dol_escape_htmltag($task_time->note, 0, 1).'</textarea>';  | 
                                                        |
| 2581 | 2581 |  					} else { | 
                                                        
| 2582 | 2582 | print dol_nl2br($task_time->note);  | 
                                                        
| 2583 | 2583 | }  | 
                                                        
| 2584 | 2584 | print '</td>';  | 
                                                        
| 2585 | 2585 |  				} elseif ($action == 'splitline' && GETPOST('lineid', 'int') == $task_time->rowid) { | 
                                                        
| 2586 | - print '<input type="hidden" name="timespent_note_line" rows="' . ROWS_1 . '" value="' . dol_escape_htmltag($task_time->note, 0, 1) . '">';  | 
                                                        |
| 2586 | + print '<input type="hidden" name="timespent_note_line" rows="'.ROWS_1.'" value="'.dol_escape_htmltag($task_time->note, 0, 1).'">';  | 
                                                        |
| 2587 | 2587 | }  | 
                                                        
| 2588 | 2588 | |
| 2589 | 2589 | // Time spent  | 
                                                        
@@ -2716,7 +2716,7 @@ discard block  | 
                                                    ||
| 2716 | 2716 |  							print img_object('', 'user', 'class="hideonsmartphone"'); | 
                                                        
| 2717 | 2717 | print $form->select_dolusers($task_time->fk_user, 'userid_line_2', 0, '', 0, '', $contactsoftask);  | 
                                                        
| 2718 | 2718 |  						} else { | 
                                                        
| 2719 | -							print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime'); | 
                                                        |
| 2719 | +							print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); | 
                                                        |
| 2720 | 2720 | }  | 
                                                        
| 2721 | 2721 |  					} else { | 
                                                        
| 2722 | 2722 | $userstatic->id = $task_time->fk_user;  | 
                                                        
@@ -2733,13 +2733,13 @@ discard block  | 
                                                    ||
| 2733 | 2733 |  				if (!empty($arrayfields['t.note']['checked'])) { | 
                                                        
| 2734 | 2734 | print '<td class="small tdoverflowmax300"">';  | 
                                                        
| 2735 | 2735 |  					if ($action == 'splitline' && GETPOST('lineid', 'int') == $task_time->rowid) { | 
                                                        
| 2736 | - print '<textarea name="timespent_note_line_2" width="95%" rows="' . ROWS_1 . '">' . dol_escape_htmltag($task_time->note, 0, 1) . '</textarea>';  | 
                                                        |
| 2736 | + print '<textarea name="timespent_note_line_2" width="95%" rows="'.ROWS_1.'">'.dol_escape_htmltag($task_time->note, 0, 1).'</textarea>';  | 
                                                        |
| 2737 | 2737 |  					} else { | 
                                                        
| 2738 | 2738 | print dol_nl2br($task_time->note);  | 
                                                        
| 2739 | 2739 | }  | 
                                                        
| 2740 | 2740 | print '</td>';  | 
                                                        
| 2741 | 2741 |  				} elseif ($action == 'splitline' && GETPOST('lineid', 'int') == $task_time->rowid) { | 
                                                        
| 2742 | - print '<input type="hidden" name="timespent_note_line_2" value="' . dol_escape_htmltag($task_time->note, 0, 1) . '">';  | 
                                                        |
| 2742 | + print '<input type="hidden" name="timespent_note_line_2" value="'.dol_escape_htmltag($task_time->note, 0, 1).'">';  | 
                                                        |
| 2743 | 2743 | }  | 
                                                        
| 2744 | 2744 | |
| 2745 | 2745 | // Time spent  | 
                                                        
@@ -2811,14 +2811,14 @@ discard block  | 
                                                    ||
| 2811 | 2811 | $i++;  | 
                                                        
| 2812 | 2812 |  				if ($i == 1) { | 
                                                        
| 2813 | 2813 |  					if ($num < $limit && empty($offset)) { | 
                                                        
| 2814 | -						print '<td class="left">' . $langs->trans("Total") . '</td>'; | 
                                                        |
| 2814 | +						print '<td class="left">'.$langs->trans("Total").'</td>'; | 
                                                        |
| 2815 | 2815 |  					} else { | 
                                                        
| 2816 | 2816 |  						print '<td class="left">'.$form->textwithpicto($langs->trans("Total"), $langs->trans("Totalforthispage")).'</td>'; | 
                                                        
| 2817 | 2817 | }  | 
                                                        
| 2818 | 2818 |  				} elseif (isset($totalarray['totaldurationfield']) && $totalarray['totaldurationfield'] == $i) { | 
                                                        
| 2819 | - print '<td class="right">' . convertSecondToTime($totalarray['totalduration'], 'allhourmin') . '</td>';  | 
                                                        |
| 2819 | + print '<td class="right">'.convertSecondToTime($totalarray['totalduration'], 'allhourmin').'</td>';  | 
                                                        |
| 2820 | 2820 |  				} elseif (isset($totalarray['totalvaluefield']) && $totalarray['totalvaluefield'] == $i) { | 
                                                        
| 2821 | - print '<td class="right">' . price($totalarray['totalvalue']) . '</td>';  | 
                                                        |
| 2821 | + print '<td class="right">'.price($totalarray['totalvalue']).'</td>';  | 
                                                        |
| 2822 | 2822 |  					//} elseif ($totalarray['totalvaluebilledfield'] == $i) { print '<td class="center">'.price($totalarray['totalvaluebilled']).'</td>'; | 
                                                        
| 2823 | 2823 |  				} else { | 
                                                        
| 2824 | 2824 | print '<td></td>';  | 
                                                        
@@ -2834,8 +2834,8 @@ discard block  | 
                                                    ||
| 2834 | 2834 | $totalnboffields++;  | 
                                                        
| 2835 | 2835 | }  | 
                                                        
| 2836 | 2836 | }  | 
                                                        
| 2837 | - print '<tr class="oddeven"><td colspan="' . $totalnboffields . '">';  | 
                                                        |
| 2838 | -			print '<span class="opacitymedium">' . $langs->trans("None") . '</span>'; | 
                                                        |
| 2837 | + print '<tr class="oddeven"><td colspan="'.$totalnboffields.'">';  | 
                                                        |
| 2838 | +			print '<span class="opacitymedium">'.$langs->trans("None").'</span>'; | 
                                                        |
| 2839 | 2839 | print '</td></tr>';  | 
                                                        
| 2840 | 2840 | }  | 
                                                        
| 2841 | 2841 | |
@@ -91,7 +91,7 @@ discard block  | 
                                                    ||
| 91 | 91 | |
| 92 | 92 | require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/AutoLoader.php';  | 
                                                        
| 93 | 93 | |
| 94 | -call_user_func(function () { | 
                                                        |
| 94 | +call_user_func(function() { | 
                                                        |
| 95 | 95 | $loader = Luracast\Restler\AutoLoader::instance();  | 
                                                        
| 96 | 96 | spl_autoload_register($loader);  | 
                                                        
| 97 | 97 | return $loader;  | 
                                                        
@@ -169,7 +169,7 @@ discard block  | 
                                                    ||
| 169 | 169 | // If MAIN_API_DEBUG is set to 1, we save logs into file "dolibarr_api.log"  | 
                                                        
| 170 | 170 |  if (getDolGlobalString('MAIN_API_DEBUG')) { | 
                                                        
| 171 | 171 | $r = $api->r;  | 
                                                        
| 172 | -	$r->onCall(function () use ($r) { | 
                                                        |
| 172 | +	$r->onCall(function() use ($r) { | 
                                                        |
| 173 | 173 | // Don't log Luracast Restler Explorer resources calls  | 
                                                        
| 174 | 174 |  		//if (!preg_match('/^explorer/', $r->url)) { | 
                                                        
| 175 | 175 | // 'method' => $api->r->requestMethod,  | 
                                                        
@@ -201,7 +201,7 @@ discard block  | 
                                                    ||
| 201 | 201 |  	$allowedip = explode(' ', getDolGlobalString('API_RESTRICT_ON_IP')); | 
                                                        
| 202 | 202 | $ipremote = getUserRemoteIP();  | 
                                                        
| 203 | 203 |  	if (!in_array($ipremote, $allowedip)) { | 
                                                        
| 204 | -		dol_syslog('Remote ip is '.$ipremote.', not into list ' . getDolGlobalString('API_RESTRICT_ON_IP')); | 
                                                        |
| 204 | +		dol_syslog('Remote ip is '.$ipremote.', not into list '.getDolGlobalString('API_RESTRICT_ON_IP')); | 
                                                        |
| 205 | 205 | print 'APIs are not allowed from the IP '.$ipremote;  | 
                                                        
| 206 | 206 |  		header('HTTP/1.1 503 API not allowed from your IP '.$ipremote); | 
                                                        
| 207 | 207 | //session_destroy();  | 
                                                        
@@ -354,7 +354,7 @@ discard block  | 
                                                    ||
| 354 | 354 | }  | 
                                                        
| 355 | 355 | }  | 
                                                        
| 356 | 356 | |
| 357 | -		if (! $endpointisallowed) { | 
                                                        |
| 357 | +		if (!$endpointisallowed) { | 
                                                        |
| 358 | 358 |  			dol_syslog('The API with endpoint /'.$classfile.' is forbidden by config API_ENDPOINT_RULES', LOG_WARNING); | 
                                                        
| 359 | 359 | print 'The API with endpoint /'.$classfile.' is forbidden by config API_ENDPOINT_RULES';  | 
                                                        
| 360 | 360 |  			header('HTTP/1.1 501 API is forbidden by API_ENDPOINT_RULES'); | 
                                                        
@@ -436,7 +436,7 @@ discard block  | 
                                                    ||
| 436 | 436 | |
| 437 | 437 | // Call API termination method  | 
                                                        
| 438 | 438 | $apiMethodInfo = &$api->r->apiMethodInfo;  | 
                                                        
| 439 | -$terminateCall = '_terminate_' . $apiMethodInfo->methodName . '_' . $api->r->responseFormat->getExtension();  | 
                                                        |
| 439 | +$terminateCall = '_terminate_'.$apiMethodInfo->methodName.'_'.$api->r->responseFormat->getExtension();  | 
                                                        |
| 440 | 440 |  if (method_exists($apiMethodInfo->className, $terminateCall)) { | 
                                                        
| 441 | 441 | // Now flush output buffers so that response data is sent to the client even if we still have action to do in a termination method.  | 
                                                        
| 442 | 442 | ob_end_flush();  |