@@ -80,7 +80,7 @@  | 
                                                    ||
| 80 | 80 | $socid = $user->socid;  | 
                                                        
| 81 | 81 | }  | 
                                                        
| 82 | 82 | |
| 83 | -$result = restrictedArea($user, 'expedition', 0, ''); // We use 0 for id, because there is no particular shipment on this tab, only id of order is known  | 
                                                        |
| 83 | +$result = restrictedArea($user, 'expedition', 0, ''); // We use 0 for id, because there is no particular shipment on this tab, only id of order is known  | 
                                                        |
| 84 | 84 | |
| 85 | 85 |  $permissiontoread = $user->hasRight('expedition', 'lire'); | 
                                                        
| 86 | 86 |  $permissiontoadd = $user->hasRight('expedition', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php | 
                                                        
@@ -57,13 +57,13 @@  | 
                                                    ||
| 57 | 57 | |
| 58 | 58 | print "*** TEST READ OF /tmp/test.txt FILE (Example: if file exists and owned by apache process owner + PrivateTmp is false + apparmor rules allows read of owned files in /tmp/, then you should see the file)<br>\n";  | 
                                                        
| 59 | 59 | |
| 60 | -$out='';  | 
                                                        |
| 61 | -$ret=0;  | 
                                                        |
| 60 | +$out = '';  | 
                                                        |
| 61 | +$ret = 0;  | 
                                                        |
| 62 | 62 | |
| 63 | 63 | $file = '/tmp/test.txt';  | 
                                                        
| 64 | -$f=fopen($file, 'r');  | 
                                                        |
| 64 | +$f = fopen($file, 'r');  | 
                                                        |
| 65 | 65 |  if ($f) { | 
                                                        
| 66 | - $s=fread($f, 4096);  | 
                                                        |
| 66 | + $s = fread($f, 4096);  | 
                                                        |
| 67 | 67 | print $s;  | 
                                                        
| 68 | 68 | fclose($f);  | 
                                                        
| 69 | 69 |  } else { | 
                                                        
@@ -81,14 +81,14 @@ discard block  | 
                                                    ||
| 81 | 81 | }  | 
                                                        
| 82 | 82 | |
| 83 | 83 | // General $Variables  | 
                                                        
| 84 | -$id = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('facid'));    // For backward compatibility | 
                                                        |
| 84 | +$id = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('facid')); // For backward compatibility | 
                                                        |
| 85 | 85 |  $ref = GETPOST('ref', 'alpha'); | 
                                                        
| 86 | 86 |  $socid = GETPOSTINT('socid'); | 
                                                        
| 87 | 87 |  $action = GETPOST('action', 'aZ09'); | 
                                                        
| 88 | 88 |  $confirm = GETPOST('confirm', 'alpha'); | 
                                                        
| 89 | 89 |  $cancel = GETPOST('cancel', 'alpha'); | 
                                                        
| 90 | -$backtopage = GETPOST('backtopage', 'alpha');					// if not set, a default page will be used | 
                                                        |
| 91 | -$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');	// if not set, $backtopage will be used | 
                                                        |
| 90 | +$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used | 
                                                        |
| 91 | +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used | 
                                                        |
| 92 | 92 |  $lineid = GETPOSTINT('lineid'); | 
                                                        
| 93 | 93 |  $userid = GETPOSTINT('userid'); | 
                                                        
| 94 | 94 |  $search_ref = GETPOST('sf_ref', 'alpha') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); | 
                                                        
@@ -248,7 +248,7 @@ discard block  | 
                                                    ||
| 248 | 248 |  					setEventMessages('', $warningMsgLineList, 'warnings'); | 
                                                        
| 249 | 249 | }  | 
                                                        
| 250 | 250 | |
| 251 | -				header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $result); | 
                                                        |
| 251 | +				header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$result); | 
                                                        |
| 252 | 252 | exit();  | 
                                                        
| 253 | 253 |  			} else { | 
                                                        
| 254 | 254 |  				$langs->load("errors"); | 
                                                        
@@ -339,7 +339,7 @@ discard block  | 
                                                    ||
| 339 | 339 | // Validation  | 
                                                        
| 340 | 340 | $object->fetch($id);  | 
                                                        
| 341 | 341 | |
| 342 | -		if ((preg_match('/^[\(]?PROV/i', $object->ref) || empty($object->ref)) &&	// empty should not happened, but when it occurs, the test save life | 
                                                        |
| 342 | +		if ((preg_match('/^[\(]?PROV/i', $object->ref) || empty($object->ref)) && // empty should not happened, but when it occurs, the test save life | 
                                                        |
| 343 | 343 |  			getDolGlobalString('FAC_FORCE_DATE_VALIDATION')								// If option enabled, we force invoice date | 
                                                        
| 344 | 344 |  		) { | 
                                                        
| 345 | 345 | $object->date = dol_now();  | 
                                                        
@@ -1051,7 +1051,7 @@ discard block  | 
                                                    ||
| 1051 | 1051 | $error++;  | 
                                                        
| 1052 | 1052 | }  | 
                                                        
| 1053 | 1053 | |
| 1054 | -		$dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver');	// If we enter the 02 january, we need to save the 02 january for server | 
                                                        |
| 1054 | +		$dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server | 
                                                        |
| 1055 | 1055 |  		$date_pointoftax = dol_mktime(0, 0, 0, GETPOSTINT('date_pointoftaxmonth'), GETPOSTINT('date_pointoftaxday'), GETPOSTINT('date_pointoftaxyear'), 'tzserver'); | 
                                                        
| 1056 | 1056 | |
| 1057 | 1057 | // Replacement invoice  | 
                                                        
@@ -1083,7 +1083,7 @@ discard block  | 
                                                    ||
| 1083 | 1083 |  				$object->note_private		= trim(GETPOST('note_private', 'restricthtml')); | 
                                                        
| 1084 | 1084 |  				$object->ref_client			= GETPOST('ref_client', 'alphanohtml'); | 
                                                        
| 1085 | 1085 |  				$object->ref_customer		= GETPOST('ref_client', 'alphanohtml'); | 
                                                        
| 1086 | -				$object->model_pdf          = GETPOST('model', 'alphanohtml'); | 
                                                        |
| 1086 | +				$object->model_pdf = GETPOST('model', 'alphanohtml'); | 
                                                        |
| 1087 | 1087 |  				$object->fk_project			= GETPOSTINT('projectid'); | 
                                                        
| 1088 | 1088 |  				$object->cond_reglement_id	= GETPOSTINT('cond_reglement_id'); | 
                                                        
| 1089 | 1089 |  				$object->mode_reglement_id	= GETPOSTINT('mode_reglement_id'); | 
                                                        
@@ -1144,9 +1144,9 @@ discard block  | 
                                                    ||
| 1144 | 1144 |  				$object->note_private		= trim(GETPOST('note_private', 'restricthtml')); | 
                                                        
| 1145 | 1145 |  				$object->ref_client			= GETPOST('ref_client', 'alphanohtml'); | 
                                                        
| 1146 | 1146 |  				$object->ref_customer		= GETPOST('ref_client', 'alphanohtml'); | 
                                                        
| 1147 | -				$object->model_pdf          = GETPOST('model'); | 
                                                        |
| 1147 | +				$object->model_pdf = GETPOST('model'); | 
                                                        |
| 1148 | 1148 |  				$object->fk_project			= GETPOSTINT('projectid'); | 
                                                        
| 1149 | - $object->cond_reglement_id = 0; // No payment term for a credit note  | 
                                                        |
| 1149 | + $object->cond_reglement_id = 0; // No payment term for a credit note  | 
                                                        |
| 1150 | 1150 |  				$object->mode_reglement_id	= GETPOSTINT('mode_reglement_id'); | 
                                                        
| 1151 | 1151 |  				$object->fk_account         = GETPOSTINT('fk_account'); | 
                                                        
| 1152 | 1152 |  				//$object->remise_absolue		= price2num(GETPOST('remise_absolue'), 'MU'); | 
                                                        
@@ -1468,7 +1468,7 @@ discard block  | 
                                                    ||
| 1468 | 1468 |  				$object->note_public		= trim(GETPOST('note_public', 'restricthtml')); | 
                                                        
| 1469 | 1469 |  				$object->note_private       = trim(GETPOST('note_private', 'restricthtml')); | 
                                                        
| 1470 | 1470 |  				$object->ref_client			= GETPOST('ref_client'); | 
                                                        
| 1471 | -				$object->ref_customer		= GETPOST('ref_client'); | 
                                                        |
| 1471 | +				$object->ref_customer = GETPOST('ref_client'); | 
                                                        |
| 1472 | 1472 |  				$object->model_pdf          = GETPOST('model'); | 
                                                        
| 1473 | 1473 |  				$object->fk_project			= GETPOSTINT('projectid'); | 
                                                        
| 1474 | 1474 |  				$object->cond_reglement_id	= (GETPOSTINT('type') == 3 ? 1 : GETPOST('cond_reglement_id')); | 
                                                        
@@ -1532,7 +1532,7 @@ discard block  | 
                                                    ||
| 1532 | 1532 | $element = $subelement = 'expedition';  | 
                                                        
| 1533 | 1533 | }  | 
                                                        
| 1534 | 1534 | |
| 1535 | - $object->origin = $origin; // deprecated  | 
                                                        |
| 1535 | + $object->origin = $origin; // deprecated  | 
                                                        |
| 1536 | 1536 | $object->origin_type = $origin;  | 
                                                        
| 1537 | 1537 | $object->origin_id = $originid;  | 
                                                        
| 1538 | 1538 | |
@@ -1965,7 +1965,7 @@ discard block  | 
                                                    ||
| 1965 | 1965 |  				if (!empty($origin) && !empty($originid)) { | 
                                                        
| 1966 | 1966 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';  | 
                                                        
| 1967 | 1967 | |
| 1968 | - $object->origin = $origin; // deprecated  | 
                                                        |
| 1968 | + $object->origin = $origin; // deprecated  | 
                                                        |
| 1969 | 1969 | $object->origin_type = $origin;  | 
                                                        
| 1970 | 1970 | $object->origin_id = $originid;  | 
                                                        
| 1971 | 1971 | |
@@ -1991,7 +1991,7 @@ discard block  | 
                                                    ||
| 1991 | 1991 | $line->fk_prev_id = $line->id;  | 
                                                        
| 1992 | 1992 | $line->fetch_optionals();  | 
                                                        
| 1993 | 1993 |  						if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) { | 
                                                        
| 1994 | - $line->situation_percent = $line->get_allprev_progress($object->id);; // get good progress including credit note  | 
                                                        |
| 1994 | + $line->situation_percent = $line->get_allprev_progress($object->id); ; // get good progress including credit note  | 
                                                        |
| 1995 | 1995 |  						} else { | 
                                                        
| 1996 | 1996 | $line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note  | 
                                                        
| 1997 | 1997 | }  | 
                                                        
@@ -2101,7 +2101,7 @@ discard block  | 
                                                    ||
| 2101 | 2101 |  		} else { | 
                                                        
| 2102 | 2102 | $db->rollback();  | 
                                                        
| 2103 | 2103 | $action = 'create';  | 
                                                        
| 2104 | - $_GET["origin"] = $_POST["origin"]; // Keep GET and POST here ?  | 
                                                        |
| 2104 | + $_GET["origin"] = $_POST["origin"]; // Keep GET and POST here ?  | 
                                                        |
| 2105 | 2105 | $_GET["originid"] = $_POST["originid"]; // Keep GET and POST here ?  | 
                                                        
| 2106 | 2106 | setEventMessages($object->error, $object->errors, 'errors');  | 
                                                        
| 2107 | 2107 | }  | 
                                                        
@@ -2128,7 +2128,7 @@ discard block  | 
                                                    ||
| 2128 | 2128 |  		$remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0); | 
                                                        
| 2129 | 2129 |  		$remise_percent = str_replace('*', '', $remise_percent); | 
                                                        
| 2130 | 2130 |  		foreach ($object->lines as $line) { | 
                                                        
| 2131 | - $tvatx= $line->tva_tx;  | 
                                                        |
| 2131 | + $tvatx = $line->tva_tx;  | 
                                                        |
| 2132 | 2132 |  			if (!empty($line->vat_src_code)) { | 
                                                        
| 2133 | 2133 |  				$tvatx .= ' ('.$line->vat_src_code.')'; | 
                                                        
| 2134 | 2134 | }  | 
                                                        
@@ -2648,7 +2648,7 @@ discard block  | 
                                                    ||
| 2648 | 2648 | // Define special_code for special lines  | 
                                                        
| 2649 | 2649 |  		$special_code = GETPOSTINT('special_code'); | 
                                                        
| 2650 | 2650 |  		if ($special_code == 3) { | 
                                                        
| 2651 | - $special_code = 0; // Options should not exists on invoices  | 
                                                        |
| 2651 | + $special_code = 0; // Options should not exists on invoices  | 
                                                        |
| 2652 | 2652 | }  | 
                                                        
| 2653 | 2653 | |
| 2654 | 2654 | $line = new FactureLigne($db);  | 
                                                        
@@ -3209,7 +3209,7 @@ discard block  | 
                                                    ||
| 3209 | 3209 | $subelement = $regs[2];  | 
                                                        
| 3210 | 3210 | }  | 
                                                        
| 3211 | 3211 | |
| 3212 | -		$dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver');	// If we enter the 02 january, we need to save the 02 january for server | 
                                                        |
| 3212 | +		$dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server | 
                                                        |
| 3213 | 3213 |  		$date_pointoftax = dol_mktime(0, 0, 0, GETPOSTINT('date_pointoftaxmonth'), GETPOSTINT('date_pointoftaxday'), GETPOSTINT('date_pointoftaxyear'), 'tzserver'); | 
                                                        
| 3214 | 3214 | |
| 3215 | 3215 |  		if ($element == 'project') { | 
                                                        
@@ -3280,8 +3280,8 @@ discard block  | 
                                                    ||
| 3280 | 3280 | $fk_account = (!empty($expesrc->fk_account) ? $expesrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0));  | 
                                                        
| 3281 | 3281 | |
| 3282 | 3282 |  				if (isModEnabled('multicurrency')) { | 
                                                        
| 3283 | - $currency_code = (!empty($expesrc->multicurrency_code) ? $expesrc->multicurrency_code : (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : $objectsrc->multicurrency_code));  | 
                                                        |
| 3284 | - $currency_tx = (!empty($expesrc->multicurrency_tx) ? $expesrc->multicurrency_tx : (!empty($soc->multicurrency_tx) ? $soc->multicurrency_tx : $objectsrc->multicurrency_tx));  | 
                                                        |
| 3283 | + $currency_code = (!empty($expesrc->multicurrency_code) ? $expesrc->multicurrency_code : (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : $objectsrc->multicurrency_code));  | 
                                                        |
| 3284 | + $currency_tx = (!empty($expesrc->multicurrency_tx) ? $expesrc->multicurrency_tx : (!empty($soc->multicurrency_tx) ? $soc->multicurrency_tx : $objectsrc->multicurrency_tx));  | 
                                                        |
| 3285 | 3285 | }  | 
                                                        
| 3286 | 3286 | |
| 3287 | 3287 | //Replicate extrafields  | 
                                                        
@@ -3374,7 +3374,7 @@ discard block  | 
                                                    ||
| 3374 | 3374 | print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST" id="formtocreate" name="formtocreate">';  | 
                                                        
| 3375 | 3375 | print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        
| 3376 | 3376 | print '<input type="hidden" name="action" id="formtocreateaction" value="add">';  | 
                                                        
| 3377 | - print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change  | 
                                                        |
| 3377 | + print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change  | 
                                                        |
| 3378 | 3378 |  	if ($soc->id > 0) { | 
                                                        
| 3379 | 3379 | print '<input type="hidden" name="socid" value="'.$soc->id.'">'."\n";  | 
                                                        
| 3380 | 3380 | }  | 
                                                        
@@ -3895,8 +3895,8 @@ discard block  | 
                                                    ||
| 3895 | 3895 |  		if ($socid > 0) { | 
                                                        
| 3896 | 3896 |  			print '<tr><td>'.$langs->trans('DiscountStillRemaining').'</td><td colspan="2">'; | 
                                                        
| 3897 | 3897 | |
| 3898 | - $thirdparty = $soc; // used by object_discounts.tpl.php  | 
                                                        |
| 3899 | - $discount_type = 0; // used by object_discounts.tpl.php  | 
                                                        |
| 3898 | + $thirdparty = $soc; // used by object_discounts.tpl.php  | 
                                                        |
| 3899 | + $discount_type = 0; // used by object_discounts.tpl.php  | 
                                                        |
| 3900 | 3900 |  			$backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode((string) (GETPOST('origin'))).'&originid='.urlencode((string) (GETPOSTINT('originid'))); | 
                                                        
| 3901 | 3901 | include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';  | 
                                                        
| 3902 | 3902 | |
@@ -4418,7 +4418,7 @@ discard block  | 
                                                    ||
| 4418 | 4418 | $nbMandated = 0;  | 
                                                        
| 4419 | 4419 |  		foreach ($object->lines as $line) { | 
                                                        
| 4420 | 4420 | $res = $line->fetch_product();  | 
                                                        
| 4421 | -			if ($res  > 0) { | 
                                                        |
| 4421 | +			if ($res > 0) { | 
                                                        |
| 4422 | 4422 |  				if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end))) { | 
                                                        
| 4423 | 4423 | $nbMandated++;  | 
                                                        
| 4424 | 4424 | break;  | 
                                                        
@@ -4627,7 +4627,7 @@ discard block  | 
                                                    ||
| 4627 | 4627 | }  | 
                                                        
| 4628 | 4628 | // Ref customer  | 
                                                        
| 4629 | 4629 |  	$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_customer, $object, $usercancreate, 'string', '', 0, 1); | 
                                                        
| 4630 | -	$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_customer, $object, $usercancreate, 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); | 
                                                        |
| 4630 | +	$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_customer, $object, $usercancreate, 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); | 
                                                        |
| 4631 | 4631 | // Thirdparty  | 
                                                        
| 4632 | 4632 | $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'customer');  | 
                                                        
| 4633 | 4633 |  	if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { | 
                                                        
@@ -5058,45 +5058,45 @@ discard block  | 
                                                    ||
| 5058 | 5058 | }  | 
                                                        
| 5059 | 5059 | print '<tr>';  | 
                                                        
| 5060 | 5060 | // Amount HT  | 
                                                        
| 5061 | -		print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>'; | 
                                                        |
| 5062 | - print '<td class="nowrap amountcard right">' . price($sign * $object->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';  | 
                                                        |
| 5061 | +		print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; | 
                                                        |
| 5062 | + print '<td class="nowrap amountcard right">'.price($sign * $object->total_ht, 0, $langs, 0, -1, -1, $conf->currency).'</td>';  | 
                                                        |
| 5063 | 5063 |  		if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { | 
                                                        
| 5064 | 5064 | // Multicurrency Amount HT  | 
                                                        
| 5065 | - print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';  | 
                                                        |
| 5065 | + print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';  | 
                                                        |
| 5066 | 5066 | }  | 
                                                        
| 5067 | 5067 | print '</tr>';  | 
                                                        
| 5068 | 5068 | |
| 5069 | 5069 | print '<tr>';  | 
                                                        
| 5070 | 5070 | // Amount VAT  | 
                                                        
| 5071 | -		print '<td class="titlefieldmiddle">' . $langs->trans('AmountVAT') . '</td>'; | 
                                                        |
| 5072 | - print '<td class="nowrap amountcard right">' . price($sign * $object->total_tva, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';  | 
                                                        |
| 5071 | +		print '<td class="titlefieldmiddle">'.$langs->trans('AmountVAT').'</td>'; | 
                                                        |
| 5072 | + print '<td class="nowrap amountcard right">'.price($sign * $object->total_tva, 0, $langs, 0, -1, -1, $conf->currency).'</td>';  | 
                                                        |
| 5073 | 5073 |  		if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { | 
                                                        
| 5074 | 5074 | // Multicurrency Amount VAT  | 
                                                        
| 5075 | - print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';  | 
                                                        |
| 5075 | + print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';  | 
                                                        |
| 5076 | 5076 | }  | 
                                                        
| 5077 | 5077 | print '</tr>';  | 
                                                        
| 5078 | 5078 | |
| 5079 | 5079 | // Amount Local Taxes  | 
                                                        
| 5080 | 5080 |  		if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) { | 
                                                        
| 5081 | 5081 | print '<tr>';  | 
                                                        
| 5082 | -			print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>'; | 
                                                        |
| 5083 | - print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';  | 
                                                        |
| 5082 | +			print '<td class="titlefieldmiddle">'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; | 
                                                        |
| 5083 | + print '<td class="nowrap amountcard right">'.price($sign * $object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency).'</td>';  | 
                                                        |
| 5084 | 5084 |  			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { | 
                                                        
| 5085 | 5085 | $object->multicurrency_total_localtax1 = (float) price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT');  | 
                                                        
| 5086 | 5086 | |
| 5087 | - print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';  | 
                                                        |
| 5087 | + print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';  | 
                                                        |
| 5088 | 5088 | }  | 
                                                        
| 5089 | 5089 | print '</tr>';  | 
                                                        
| 5090 | 5090 | }  | 
                                                        
| 5091 | 5091 | |
| 5092 | 5092 |  		if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { | 
                                                        
| 5093 | 5093 | print '<tr>';  | 
                                                        
| 5094 | -			print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>'; | 
                                                        |
| 5095 | - print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';  | 
                                                        |
| 5094 | +			print '<td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; | 
                                                        |
| 5095 | + print '<td class="nowrap amountcard right">'.price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency).'</td>';  | 
                                                        |
| 5096 | 5096 |  			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { | 
                                                        
| 5097 | 5097 | $object->multicurrency_total_localtax2 = (float) price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT');  | 
                                                        
| 5098 | 5098 | |
| 5099 | - print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';  | 
                                                        |
| 5099 | + print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';  | 
                                                        |
| 5100 | 5100 | }  | 
                                                        
| 5101 | 5101 | print '</tr>';  | 
                                                        
| 5102 | 5102 | }  | 
                                                        
@@ -5156,11 +5156,11 @@ discard block  | 
                                                    ||
| 5156 | 5156 | |
| 5157 | 5157 | print '<tr>';  | 
                                                        
| 5158 | 5158 | // Amount TTC  | 
                                                        
| 5159 | -		print '<td>' . $langs->trans('AmountTTC') . '</td>'; | 
                                                        |
| 5160 | - print '<td class="nowrap amountcard right">' . price($sign * $object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';  | 
                                                        |
| 5159 | +		print '<td>'.$langs->trans('AmountTTC').'</td>'; | 
                                                        |
| 5160 | + print '<td class="nowrap amountcard right">'.price($sign * $object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency).'</td>';  | 
                                                        |
| 5161 | 5161 |  		if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { | 
                                                        
| 5162 | 5162 | // Multicurrency Amount TTC  | 
                                                        
| 5163 | - print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';  | 
                                                        |
| 5163 | + print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';  | 
                                                        |
| 5164 | 5164 | }  | 
                                                        
| 5165 | 5165 | print '</tr>';  | 
                                                        
| 5166 | 5166 | |
@@ -5819,7 +5819,7 @@ discard block  | 
                                                    ||
| 5819 | 5819 |  					$langs->load("contracts"); | 
                                                        
| 5820 | 5820 | |
| 5821 | 5821 |  					if ($usercancreatecontract) { | 
                                                        
| 5822 | -						print '<a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans('AddContract') . '</a>'; | 
                                                        |
| 5822 | +						print '<a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans('AddContract').'</a>'; | 
                                                        |
| 5823 | 5823 | }  | 
                                                        
| 5824 | 5824 | }  | 
                                                        
| 5825 | 5825 | }  | 
                                                        
@@ -6043,7 +6043,7 @@ discard block  | 
                                                    ||
| 6043 | 6043 |  			if ($usercandelete || ($usercancreate && $isErasable == 1)) {	// isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions) | 
                                                        
| 6044 | 6044 | $enableDelete = false;  | 
                                                        
| 6045 | 6045 | $deleteHref = '#';  | 
                                                        
| 6046 | -				if ($isErasable > 0 && ! $objectidnext) { | 
                                                        |
| 6046 | +				if ($isErasable > 0 && !$objectidnext) { | 
                                                        |
| 6047 | 6047 | $deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken();  | 
                                                        
| 6048 | 6048 | $enableDelete = true;  | 
                                                        
| 6049 | 6049 | }  | 
                                                        
@@ -55,8 +55,8 @@ discard block  | 
                                                    ||
| 55 | 55 |  	$dol_openinpopup = preg_replace('/[^a-z0-9_]/i', '', $tmpbacktopagejsfields[0]); | 
                                                        
| 56 | 56 | }  | 
                                                        
| 57 | 57 | |
| 58 | -$groups	    = GETPOST('groups', 'array:int'); | 
                                                        |
| 59 | -$resources	= GETPOST('resources', 'array:int'); | 
                                                        |
| 58 | +$groups = GETPOST('groups', 'array:int'); | 
                                                        |
| 59 | +$resources = GETPOST('resources', 'array:int'); | 
                                                        |
| 60 | 60 |  //$lineid   = GETPOST('lineid', 'int'); | 
                                                        
| 61 | 61 | |
| 62 | 62 | // Initialize a technical objects  | 
                                                        
@@ -89,10 +89,10 @@ discard block  | 
                                                    ||
| 89 | 89 | |
| 90 | 90 | // Permissions  | 
                                                        
| 91 | 91 |  $permissiontoread = $user->hasRight('workstation', 'workstation', 'read'); | 
                                                        
| 92 | -$permissiontoadd = $user->hasRight('workstation', 'workstation', 'write');      // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php | 
                                                        |
| 92 | +$permissiontoadd = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php | 
                                                        |
| 93 | 93 |  $permissiontodelete = $user->hasRight('workstation', 'workstation', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DISABLED); | 
                                                        
| 94 | -$permissionnote = $user->hasRight('workstation', 'workstation', 'write');      // Used by the include of actions_setnotes.inc.php | 
                                                        |
| 95 | -$permissiondellink = $user->hasRight('workstation', 'workstation', 'write');      // Used by the include of actions_dellink.inc.php | 
                                                        |
| 94 | +$permissionnote = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_setnotes.inc.php | 
                                                        |
| 95 | +$permissiondellink = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_dellink.inc.php | 
                                                        |
| 96 | 96 | |
| 97 | 97 | $upload_dir = rtrim(getMultidirOutput($object, '', 1), '/');  | 
                                                        
| 98 | 98 | |
@@ -106,7 +106,7 @@ discard block  | 
                                                    ||
| 106 | 106 | */  | 
                                                        
| 107 | 107 | |
| 108 | 108 | $parameters = array();  | 
                                                        
| 109 | -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);   // Note that $action and $object may have been modified by some hooks | 
                                                        |
| 109 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks | 
                                                        |
| 110 | 110 |  if ($reshook < 0) { | 
                                                        
| 111 | 111 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');  | 
                                                        
| 112 | 112 | }  | 
                                                        
@@ -126,7 +126,7 @@ discard block  | 
                                                    ||
| 126 | 126 | }  | 
                                                        
| 127 | 127 | }  | 
                                                        
| 128 | 128 | |
| 129 | - $triggermodname = 'WORKSTATION_WORKSTATION_MODIFY'; // Name of trigger action code to execute when we modify record  | 
                                                        |
| 129 | + $triggermodname = 'WORKSTATION_WORKSTATION_MODIFY'; // Name of trigger action code to execute when we modify record  | 
                                                        |
| 130 | 130 | |
| 131 | 131 | // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen  | 
                                                        
| 132 | 132 | include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';  | 
                                                        
@@ -416,11 +416,11 @@ discard block  | 
                                                    ||
| 416 | 416 | $g = new UserGroup($db);  | 
                                                        
| 417 | 417 |  		foreach ($object->usergroups as $id_group) { | 
                                                        
| 418 | 418 | $g->fetch($id_group);  | 
                                                        
| 419 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $g->getNomUrl(1, '', 0, 'categtextwhite') . '</li>';  | 
                                                        |
| 419 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$g->getNomUrl(1, '', 0, 'categtextwhite').'</li>';  | 
                                                        |
| 420 | 420 | }  | 
                                                        
| 421 | 421 | |
| 422 | -		print '<tr><td>' . $langs->trans('Groups') . '</td><td>'; | 
                                                        |
| 423 | -		print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; | 
                                                        |
| 422 | +		print '<tr><td>'.$langs->trans('Groups').'</td><td>'; | 
                                                        |
| 423 | +		print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; | 
                                                        |
| 424 | 424 | print '</td></tr>';  | 
                                                        
| 425 | 425 | }  | 
                                                        
| 426 | 426 | |
@@ -430,11 +430,11 @@ discard block  | 
                                                    ||
| 430 | 430 | $r = new Dolresource($db);  | 
                                                        
| 431 | 431 |  		foreach ($object->resources as $id_resource) { | 
                                                        
| 432 | 432 | $r->fetch($id_resource);  | 
                                                        
| 433 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $r->getNomUrl(1, '', '', 0, 'categtextwhite') . '</li>';  | 
                                                        |
| 433 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$r->getNomUrl(1, '', '', 0, 'categtextwhite').'</li>';  | 
                                                        |
| 434 | 434 | }  | 
                                                        
| 435 | 435 | |
| 436 | -		print '<tr><td>' . $langs->trans('Machines') . '</td><td>'; | 
                                                        |
| 437 | -		print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; | 
                                                        |
| 436 | +		print '<tr><td>'.$langs->trans('Machines').'</td><td>'; | 
                                                        |
| 437 | +		print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; | 
                                                        |
| 438 | 438 | print '</td></tr>';  | 
                                                        
| 439 | 439 | }  | 
                                                        
| 440 | 440 | |
@@ -99,10 +99,10 @@ discard block  | 
                                                    ||
| 99 | 99 | */  | 
                                                        
| 100 | 100 | |
| 101 | 101 | $parameters = array();  | 
                                                        
| 102 | -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);       // Note that $action and $object may have been modified by some hooks | 
                                                        |
| 102 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks | 
                                                        |
| 103 | 103 | // Delete Link  | 
                                                        
| 104 | 104 |  $permissiondellink = $user->hasRight('expedition', 'delivery', 'supprimer'); // Used by the include of actions_dellink.inc.php | 
                                                        
| 105 | -include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'  | 
                                                        |
| 105 | +include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'  | 
                                                        |
| 106 | 106 | |
| 107 | 107 |  if ($action == 'add' && $permissiontoadd) { | 
                                                        
| 108 | 108 | $db->begin();  | 
                                                        
@@ -331,7 +331,7 @@ discard block  | 
                                                    ||
| 331 | 331 | $morehtmlref = '<div class="refidno">';  | 
                                                        
| 332 | 332 | // Ref customer shipment  | 
                                                        
| 333 | 333 |  			$morehtmlref .= $form->editfieldkey("RefCustomer", '', $expedition->ref_customer, $expedition, $user->hasRight('expedition', 'creer'), 'string', '', 0, 1); | 
                                                        
| 334 | -			$morehtmlref .= $form->editfieldval("RefCustomer", '', $expedition->ref_customer, $expedition, $user->hasRight('expedition', 'creer'), 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); | 
                                                        |
| 334 | +			$morehtmlref .= $form->editfieldval("RefCustomer", '', $expedition->ref_customer, $expedition, $user->hasRight('expedition', 'creer'), 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); | 
                                                        |
| 335 | 335 |  			$morehtmlref .= '<br>'.$langs->trans("RefDeliveryReceipt").' : '.$object->ref; | 
                                                        
| 336 | 336 | // Thirdparty  | 
                                                        
| 337 | 337 | $morehtmlref .= '<br>'.$expedition->thirdparty->getNomUrl(1);  | 
                                                        
@@ -150,7 +150,7 @@ discard block  | 
                                                    ||
| 150 | 150 | |
| 151 | 151 |  	$backurlforlist = dol_buildpath('/product/stock/productlot_list.php', 1); | 
                                                        
| 152 | 152 | |
| 153 | -	if ($action == 'seteatby' && $permissiontoadd && ! GETPOST('cancel', 'alpha')) { | 
                                                        |
| 153 | +	if ($action == 'seteatby' && $permissiontoadd && !GETPOST('cancel', 'alpha')) { | 
                                                        |
| 154 | 154 |  		$newvalue = dol_mktime(12, 0, 0, GETPOSTINT('eatbymonth'), GETPOSTINT('eatbyday'), GETPOSTINT('eatbyyear')); | 
                                                        
| 155 | 155 | |
| 156 | 156 | // check parameters  | 
                                                        
@@ -175,7 +175,7 @@ discard block  | 
                                                    ||
| 175 | 175 | }  | 
                                                        
| 176 | 176 | }  | 
                                                        
| 177 | 177 | |
| 178 | -	if ($action == 'setsellby' && $permissiontoadd && ! GETPOST('cancel', 'alpha')) { | 
                                                        |
| 178 | +	if ($action == 'setsellby' && $permissiontoadd && !GETPOST('cancel', 'alpha')) { | 
                                                        |
| 179 | 179 |  		$newvalue = dol_mktime(12, 0, 0, GETPOSTINT('sellbymonth'), GETPOSTINT('sellbyday'), GETPOSTINT('sellbyyear')); | 
                                                        
| 180 | 180 | |
| 181 | 181 | // check parameters  | 
                                                        
@@ -200,7 +200,7 @@ discard block  | 
                                                    ||
| 200 | 200 | }  | 
                                                        
| 201 | 201 | }  | 
                                                        
| 202 | 202 | |
| 203 | -	if ($action == 'seteol_date' && $permissiontoadd && ! GETPOST('cancel', 'alpha')) { | 
                                                        |
| 203 | +	if ($action == 'seteol_date' && $permissiontoadd && !GETPOST('cancel', 'alpha')) { | 
                                                        |
| 204 | 204 |  		$newvalue = dol_mktime(12, 0, 0, GETPOSTINT('eol_datemonth'), GETPOSTINT('eol_dateday'), GETPOSTINT('eol_dateyear')); | 
                                                        
| 205 | 205 |  		$result = $object->setValueFrom('eol_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY'); | 
                                                        
| 206 | 206 |  		if ($result < 0) { | 
                                                        
@@ -211,7 +211,7 @@ discard block  | 
                                                    ||
| 211 | 211 | }  | 
                                                        
| 212 | 212 | }  | 
                                                        
| 213 | 213 | |
| 214 | -	if ($action == 'setmanufacturing_date' && $permissiontoadd && ! GETPOST('cancel', 'alpha')) { | 
                                                        |
| 214 | +	if ($action == 'setmanufacturing_date' && $permissiontoadd && !GETPOST('cancel', 'alpha')) { | 
                                                        |
| 215 | 215 |  		$newvalue = dol_mktime(12, 0, 0, GETPOSTINT('manufacturing_datemonth'), GETPOSTINT('manufacturing_dateday'), GETPOSTINT('manufacturing_dateyear')); | 
                                                        
| 216 | 216 |  		$result = $object->setValueFrom('manufacturing_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY'); | 
                                                        
| 217 | 217 |  		if ($result < 0) { | 
                                                        
@@ -222,7 +222,7 @@ discard block  | 
                                                    ||
| 222 | 222 | }  | 
                                                        
| 223 | 223 | }  | 
                                                        
| 224 | 224 | |
| 225 | -	if ($action == 'setscrapping_date' && $permissiontoadd && ! GETPOST('cancel', 'alpha')) { | 
                                                        |
| 225 | +	if ($action == 'setscrapping_date' && $permissiontoadd && !GETPOST('cancel', 'alpha')) { | 
                                                        |
| 226 | 226 |  		$newvalue = dol_mktime(12, 0, 0, GETPOSTINT('scrapping_datemonth'), GETPOSTINT('scrapping_dateday'), GETPOSTINT('scrapping_dateyear')); | 
                                                        
| 227 | 227 |  		$result = $object->setValueFrom('scrapping_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY'); | 
                                                        
| 228 | 228 |  		if ($result < 0) { | 
                                                        
@@ -244,7 +244,7 @@ discard block  | 
                                                    ||
| 244 | 244 | }  | 
                                                        
| 245 | 245 | } */  | 
                                                        
| 246 | 246 | |
| 247 | -	if ($action == 'setqc_frequency' && $permissiontoadd && ! GETPOST('cancel', 'alpha')) { | 
                                                        |
| 247 | +	if ($action == 'setqc_frequency' && $permissiontoadd && !GETPOST('cancel', 'alpha')) { | 
                                                        |
| 248 | 248 |  		$result = $object->setValueFrom('qc_frequency', GETPOST('qc_frequency'), '', null, 'int', '', $user, 'PRODUCT_MODIFY'); | 
                                                        
| 249 | 249 |  		if ($result < 0) { // Prévoir un test de format de durée | 
                                                        
| 250 | 250 | setEventMessages($object->error, null, 'errors');  | 
                                                        
@@ -122,7 +122,7 @@ discard block  | 
                                                    ||
| 122 | 122 |  		if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) { | 
                                                        
| 123 | 123 |  			if (!empty($perm)) { | 
                                                        
| 124 | 124 |  				$tmp = explode(':', $typeofdata); | 
                                                        
| 125 | - $ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">';  | 
                                                        |
| 125 | + $ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';  | 
                                                        |
| 126 | 126 |  				if ($fieldrequired) { | 
                                                        
| 127 | 127 | $ret .= '<span class="fieldrequired">';  | 
                                                        
| 128 | 128 | }  | 
                                                        
@@ -134,7 +134,7 @@ discard block  | 
                                                    ||
| 134 | 134 |  				if ($fieldrequired) { | 
                                                        
| 135 | 135 | $ret .= '</span>';  | 
                                                        
| 136 | 136 | }  | 
                                                        
| 137 | - $ret .= '</div>' . "\n";  | 
                                                        |
| 137 | + $ret .= '</div>'."\n";  | 
                                                        |
| 138 | 138 |  			} else { | 
                                                        
| 139 | 139 |  				if ($fieldrequired) { | 
                                                        
| 140 | 140 | $ret .= '<span class="fieldrequired">';  | 
                                                        
@@ -172,8 +172,8 @@ discard block  | 
                                                    ||
| 172 | 172 |  			if (empty($notabletag) && $perm) { | 
                                                        
| 173 | 173 | $ret .= '<td class="right">';  | 
                                                        
| 174 | 174 | }  | 
                                                        
| 175 | -			if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { | 
                                                        |
| 176 | -				$ret .= '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=edit' . $htmlname . '&token=' . newToken() . '&' . $paramid . '=' . $object->id . $moreparam . '">' . img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)) . '</a>'; | 
                                                        |
| 175 | +			if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { | 
                                                        |
| 176 | +				$ret .= '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&token='.newToken().'&'.$paramid.'='.$object->id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).'</a>'; | 
                                                        |
| 177 | 177 | }  | 
                                                        
| 178 | 178 |  			if (!empty($notabletag) && $notabletag == 1) { | 
                                                        
| 179 | 179 |  				if ($text) { | 
                                                        
@@ -240,7 +240,7 @@ discard block  | 
                                                    ||
| 240 | 240 |  			} elseif ($reg[1] == 'int') { | 
                                                        
| 241 | 241 | $typeofdata = 'numeric';  | 
                                                        
| 242 | 242 |  			} else { | 
                                                        
| 243 | - return 'ErrorBadParameter ' . $typeofdata;  | 
                                                        |
| 243 | + return 'ErrorBadParameter '.$typeofdata;  | 
                                                        |
| 244 | 244 | }  | 
                                                        
| 245 | 245 | }  | 
                                                        
| 246 | 246 | |
@@ -251,13 +251,13 @@ discard block  | 
                                                    ||
| 251 | 251 |  			if ($editaction == '') { | 
                                                        
| 252 | 252 |  				$editaction = GETPOST('action', 'aZ09'); | 
                                                        
| 253 | 253 | }  | 
                                                        
| 254 | - $editmode = ($editaction == 'edit' . $htmlname);  | 
                                                        |
| 254 | + $editmode = ($editaction == 'edit'.$htmlname);  | 
                                                        |
| 255 | 255 |  			if ($editmode) {	// edit mode | 
                                                        
| 256 | 256 | $ret .= "\n";  | 
                                                        
| 257 | - $ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">';  | 
                                                        |
| 258 | - $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';  | 
                                                        |
| 259 | - $ret .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 260 | - $ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">';  | 
                                                        |
| 257 | + $ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';  | 
                                                        |
| 258 | + $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';  | 
                                                        |
| 259 | + $ret .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 260 | + $ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';  | 
                                                        |
| 261 | 261 |  				if (empty($notabletag)) { | 
                                                        
| 262 | 262 | $ret .= '<table class="nobordernopadding centpercent">';  | 
                                                        
| 263 | 263 | }  | 
                                                        
@@ -266,28 +266,28 @@ discard block  | 
                                                    ||
| 266 | 266 | }  | 
                                                        
| 267 | 267 |  				if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) { | 
                                                        
| 268 | 268 |  					$tmp = explode(':', $typeofdata); | 
                                                        
| 269 | - $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';  | 
                                                        |
| 269 | + $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';  | 
                                                        |
| 270 | 270 |  				} elseif (preg_match('/^(integer)/', $typeofdata)) { | 
                                                        
| 271 | 271 |  					$tmp = explode(':', $typeofdata); | 
                                                        
| 272 | 272 | $valuetoshow = price2num($editvalue ? $editvalue : $value, 0);  | 
                                                        
| 273 | - $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';  | 
                                                        |
| 273 | + $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';  | 
                                                        |
| 274 | 274 |  				} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) { | 
                                                        
| 275 | 275 |  					$tmp = explode(':', $typeofdata); | 
                                                        
| 276 | 276 | $valuetoshow = price2num($editvalue ? $editvalue : $value);  | 
                                                        
| 277 | - $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';  | 
                                                        |
| 277 | + $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';  | 
                                                        |
| 278 | 278 |  				} elseif (preg_match('/^(checkbox)/', $typeofdata)) { | 
                                                        
| 279 | 279 |  					$tmp = explode(':', $typeofdata); | 
                                                        
| 280 | - $ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';  | 
                                                        |
| 280 | + $ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>';  | 
                                                        |
| 281 | 281 |  				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {    // if wysiwyg is enabled $typeofdata = 'ckeditor' | 
                                                        
| 282 | 282 |  					$tmp = explode(':', $typeofdata); | 
                                                        
| 283 | 283 | $cols = (empty($tmp[2]) ? '' : $tmp[2]);  | 
                                                        
| 284 | 284 | $morealt = '';  | 
                                                        
| 285 | 285 |  					if (preg_match('/%/', $cols)) { | 
                                                        
| 286 | - $morealt = ' style="width: ' . $cols . '"';  | 
                                                        |
| 286 | + $morealt = ' style="width: '.$cols.'"';  | 
                                                        |
| 287 | 287 | $cols = '';  | 
                                                        
| 288 | 288 | }  | 
                                                        
| 289 | 289 | $valuetoshow = ($editvalue ? $editvalue : $value);  | 
                                                        
| 290 | - $ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>';  | 
                                                        |
| 290 | + $ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>';  | 
                                                        |
| 291 | 291 | // textarea convert automatically entities chars into simple chars.  | 
                                                        
| 292 | 292 |  					// So we convert & into & so a string like 'a < <b>b</b><br>é<br><script>alert('X');<script>' stay a correct html and is not converted by textarea component when wysiwyg is off. | 
                                                        
| 293 | 293 |  					$valuetoshow = str_replace('&', '&', $valuetoshow); | 
                                                        
@@ -297,12 +297,12 @@ discard block  | 
                                                    ||
| 297 | 297 | $addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];  | 
                                                        
| 298 | 298 | $adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];  | 
                                                        
| 299 | 299 | $labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];  | 
                                                        
| 300 | - $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);  | 
                                                        |
| 300 | + $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);  | 
                                                        |
| 301 | 301 |  				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { | 
                                                        
| 302 | 302 | $addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];  | 
                                                        
| 303 | 303 | $adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];  | 
                                                        
| 304 | 304 | $labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];  | 
                                                        
| 305 | - $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);  | 
                                                        |
| 305 | + $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);  | 
                                                        |
| 306 | 306 |  				} elseif (preg_match('/^select;/', $typeofdata)) { | 
                                                        
| 307 | 307 |  					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); | 
                                                        
| 308 | 308 | $arraylist = array();  | 
                                                        
@@ -316,7 +316,7 @@ discard block  | 
                                                    ||
| 316 | 316 | // TODO Not yet implemented. See code for extrafields  | 
                                                        
| 317 | 317 |  				} elseif (preg_match('/^ckeditor/', $typeofdata)) { | 
                                                        
| 318 | 318 |  					$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser | 
                                                        
| 319 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';  | 
                                                        |
| 319 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';  | 
                                                        |
| 320 | 320 | $doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? 100 : (int) $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 : (int) $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7]));  | 
                                                        
| 321 | 321 | $ret .= $doleditor->Create(1);  | 
                                                        
| 322 | 322 |  				} elseif ($typeofdata == 'asis') { | 
                                                        
@@ -331,19 +331,19 @@ discard block  | 
                                                    ||
| 331 | 331 | $ret .= '<td>';  | 
                                                        
| 332 | 332 | }  | 
                                                        
| 333 | 333 | //else $ret.='<div class="clearboth"></div>';  | 
                                                        
| 334 | -				$ret .= '<input type="submit" class="smallpaddingimp button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 334 | +				$ret .= '<input type="submit" class="smallpaddingimp button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 335 | 335 |  				if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) { | 
                                                        
| 336 | - $ret .= '<br>' . "\n";  | 
                                                        |
| 336 | + $ret .= '<br>'."\n";  | 
                                                        |
| 337 | 337 | }  | 
                                                        
| 338 | -				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">'; | 
                                                        |
| 338 | +				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">'; | 
                                                        |
| 339 | 339 |  				if (empty($notabletag)) { | 
                                                        
| 340 | 340 | $ret .= '</td>';  | 
                                                        
| 341 | 341 | }  | 
                                                        
| 342 | 342 | |
| 343 | 343 |  				if (empty($notabletag)) { | 
                                                        
| 344 | - $ret .= '</tr></table>' . "\n";  | 
                                                        |
| 344 | + $ret .= '</tr></table>'."\n";  | 
                                                        |
| 345 | 345 | }  | 
                                                        
| 346 | - $ret .= '</form>' . "\n";  | 
                                                        |
| 346 | + $ret .= '</form>'."\n";  | 
                                                        |
| 347 | 347 |  			} else {		// view mode | 
                                                        
| 348 | 348 |  				if (preg_match('/^email/', $typeofdata)) { | 
                                                        
| 349 | 349 | $ret .= dol_print_email($value, 0, 0, 0, 0, 1);  | 
                                                        
@@ -355,15 +355,15 @@ discard block  | 
                                                    ||
| 355 | 355 | $ret .= ($value != '' ? price($value, 0, $langs, 0, -1, -1, $conf->currency) : '');  | 
                                                        
| 356 | 356 |  				} elseif (preg_match('/^checkbox/', $typeofdata)) { | 
                                                        
| 357 | 357 |  					$tmp = explode(':', $typeofdata); | 
                                                        
| 358 | - $ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>';  | 
                                                        |
| 358 | + $ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>';  | 
                                                        |
| 359 | 359 |  				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { | 
                                                        
| 360 | 360 | $ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1));  | 
                                                        
| 361 | 361 |  				} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) {	// 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring' | 
                                                        
| 362 | 362 | $ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value));  | 
                                                        
| 363 | 363 |  				} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') { | 
                                                        
| 364 | - $ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>';  | 
                                                        |
| 364 | + $ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>';  | 
                                                        |
| 365 | 365 |  				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { | 
                                                        
| 366 | - $ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>';  | 
                                                        |
| 366 | + $ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>';  | 
                                                        |
| 367 | 367 |  				} elseif (preg_match('/^select;/', $typeofdata)) { | 
                                                        
| 368 | 368 |  					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); | 
                                                        
| 369 | 369 | $arraylist = array();  | 
                                                        
@@ -374,9 +374,9 @@ discard block  | 
                                                    ||
| 374 | 374 | $ret .= $arraylist[$value];  | 
                                                        
| 375 | 375 |  					if ($htmlname == 'fk_product_type') { | 
                                                        
| 376 | 376 |  						if ($value == 0) { | 
                                                        
| 377 | -							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; | 
                                                        |
| 377 | +							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; | 
                                                        |
| 378 | 378 |  						} else { | 
                                                        
| 379 | -							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret; | 
                                                        |
| 379 | +							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret; | 
                                                        |
| 380 | 380 | }  | 
                                                        
| 381 | 381 | }  | 
                                                        
| 382 | 382 |  				} elseif (preg_match('/^ckeditor/', $typeofdata)) { | 
                                                        
@@ -384,7 +384,7 @@ discard block  | 
                                                    ||
| 384 | 384 |  					if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { | 
                                                        
| 385 | 385 |  						$firstline = preg_replace('/<br>.*/', '', $tmpcontent); | 
                                                        
| 386 | 386 |  						$firstline = preg_replace('/[\n\r].*/', '', $firstline); | 
                                                        
| 387 | - $tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');  | 
                                                        |
| 387 | + $tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');  | 
                                                        |
| 388 | 388 | }  | 
                                                        
| 389 | 389 | // We don't use dol_escape_htmltag to get the html formatting active, but this need we must also  | 
                                                        
| 390 | 390 | // clean data from some dangerous html  | 
                                                        
@@ -393,7 +393,7 @@ discard block  | 
                                                    ||
| 393 | 393 |  					if (empty($moreoptions['valuealreadyhtmlescaped'])) { | 
                                                        
| 394 | 394 | $ret .= dol_escape_htmltag($value);  | 
                                                        
| 395 | 395 |  					} else { | 
                                                        
| 396 | - $ret .= $value; // $value must be already html escaped.  | 
                                                        |
| 396 | + $ret .= $value; // $value must be already html escaped.  | 
                                                        |
| 397 | 397 | }  | 
                                                        
| 398 | 398 | }  | 
                                                        
| 399 | 399 | |
@@ -431,7 +431,7 @@ discard block  | 
                                                    ||
| 431 | 431 | |
| 432 | 432 |  		if (is_array($arrayoflangcode) && count($arrayoflangcode)) { | 
                                                        
| 433 | 433 |  			if (!is_object($extralanguages)) { | 
                                                        
| 434 | - include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';  | 
                                                        |
| 434 | + include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';  | 
                                                        |
| 435 | 435 | $extralanguages = new ExtraLanguages($this->db);  | 
                                                        
| 436 | 436 | }  | 
                                                        
| 437 | 437 |  			$extralanguages->fetch_name_extralanguages('societe'); | 
                                                        
@@ -440,17 +440,17 @@ discard block  | 
                                                    ||
| 440 | 440 | return ''; // No extralang field to show  | 
                                                        
| 441 | 441 | }  | 
                                                        
| 442 | 442 | |
| 443 | - $result .= '<!-- Widget for translation -->' . "\n";  | 
                                                        |
| 444 | - $result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">';  | 
                                                        |
| 443 | + $result .= '<!-- Widget for translation -->'."\n";  | 
                                                        |
| 444 | + $result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">';  | 
                                                        |
| 445 | 445 |  			$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', false, 0, 0, '', 'fa-15 editfieldlang'); | 
                                                        
| 446 | 446 | $result .= $s;  | 
                                                        
| 447 | 447 | $result .= '</div>';  | 
                                                        
| 448 | 448 | |
| 449 | - $result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">';  | 
                                                        |
| 449 | + $result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">';  | 
                                                        |
| 450 | 450 | |
| 451 | 451 | $resultforextrlang = '';  | 
                                                        
| 452 | 452 |  			foreach ($arrayoflangcode as $langcode) { | 
                                                        
| 453 | -				$valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : ''; | 
                                                        |
| 453 | +				$valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : ''; | 
                                                        |
| 454 | 454 |  				if (empty($valuetoshow)) { | 
                                                        
| 455 | 455 | $object->fetchValuesForExtraLanguages();  | 
                                                        
| 456 | 456 | //var_dump($object->array_languages);  | 
                                                        
@@ -462,17 +462,17 @@ discard block  | 
                                                    ||
| 462 | 462 | |
| 463 | 463 | // TODO Use the showInputField() method of ExtraLanguages object  | 
                                                        
| 464 | 464 |  				if ($typeofdata == 'textarea') { | 
                                                        
| 465 | - $resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">';  | 
                                                        |
| 465 | + $resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';  | 
                                                        |
| 466 | 466 | $resultforextrlang .= $valuetoshow;  | 
                                                        
| 467 | 467 | $resultforextrlang .= '</textarea>';  | 
                                                        
| 468 | 468 |  				} else { | 
                                                        
| 469 | - $resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">';  | 
                                                        |
| 469 | + $resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">';  | 
                                                        |
| 470 | 470 | }  | 
                                                        
| 471 | 471 | }  | 
                                                        
| 472 | 472 | $result .= $resultforextrlang;  | 
                                                        
| 473 | 473 | |
| 474 | 474 | $result .= '</div>';  | 
                                                        
| 475 | -			$result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>'; | 
                                                        |
| 475 | +			$result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>'; | 
                                                        |
| 476 | 476 | }  | 
                                                        
| 477 | 477 | |
| 478 | 478 | return $result;  | 
                                                        
@@ -535,7 +535,7 @@ discard block  | 
                                                    ||
| 535 | 535 |  				if (!empty($tmp[2])) { | 
                                                        
| 536 | 536 | $savemethod = $tmp[2];  | 
                                                        
| 537 | 537 | }  | 
                                                        
| 538 | - $out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n";  | 
                                                        |
| 538 | + $out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n";  | 
                                                        |
| 539 | 539 |  			} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) { | 
                                                        
| 540 | 540 |  				$tmp = explode(':', $inputType); | 
                                                        
| 541 | 541 | $inputType = $tmp[0];  | 
                                                        
@@ -546,7 +546,7 @@ discard block  | 
                                                    ||
| 546 | 546 | $savemethod = $tmp[2];  | 
                                                        
| 547 | 547 | }  | 
                                                        
| 548 | 548 | |
| 549 | - $out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format  | 
                                                        |
| 549 | + $out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format  | 
                                                        |
| 550 | 550 |  			} elseif (preg_match('/^(select|autocomplete)/', $inputType)) { | 
                                                        
| 551 | 551 |  				$tmp = explode(':', $inputType); | 
                                                        
| 552 | 552 | $inputType = $tmp[0];  | 
                                                        
@@ -577,40 +577,40 @@ discard block  | 
                                                    ||
| 577 | 577 | }  | 
                                                        
| 578 | 578 | |
| 579 | 579 |  				if (isModEnabled('fckeditor')) { | 
                                                        
| 580 | - $out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n";  | 
                                                        |
| 580 | + $out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n";  | 
                                                        |
| 581 | 581 |  				} else { | 
                                                        
| 582 | 582 | $inputType = 'textarea';  | 
                                                        
| 583 | 583 | }  | 
                                                        
| 584 | 584 | }  | 
                                                        
| 585 | 585 | |
| 586 | - $out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n";  | 
                                                        |
| 587 | - $out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n";  | 
                                                        |
| 588 | - $out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n";  | 
                                                        |
| 589 | - $out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n";  | 
                                                        |
| 586 | + $out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n";  | 
                                                        |
| 587 | + $out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n";  | 
                                                        |
| 588 | + $out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n";  | 
                                                        |
| 589 | + $out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n";  | 
                                                        |
| 590 | 590 |  			if (!empty($savemethod)) { | 
                                                        
| 591 | - $out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n";  | 
                                                        |
| 591 | + $out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";  | 
                                                        |
| 592 | 592 | }  | 
                                                        
| 593 | 593 |  			if (!empty($ext_element)) { | 
                                                        
| 594 | - $out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n";  | 
                                                        |
| 594 | + $out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";  | 
                                                        |
| 595 | 595 | }  | 
                                                        
| 596 | 596 |  			if (!empty($custommsg)) { | 
                                                        
| 597 | 597 |  				if (is_array($custommsg)) { | 
                                                        
| 598 | 598 |  					if (!empty($custommsg['success'])) { | 
                                                        
| 599 | - $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n";  | 
                                                        |
| 599 | + $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n";  | 
                                                        |
| 600 | 600 | }  | 
                                                        
| 601 | 601 |  					if (!empty($custommsg['error'])) { | 
                                                        
| 602 | - $out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n";  | 
                                                        |
| 602 | + $out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n";  | 
                                                        |
| 603 | 603 | }  | 
                                                        
| 604 | 604 |  				} else { | 
                                                        
| 605 | - $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n";  | 
                                                        |
| 605 | + $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n";  | 
                                                        |
| 606 | 606 | }  | 
                                                        
| 607 | 607 | }  | 
                                                        
| 608 | 608 |  			if ($inputType == 'textarea') { | 
                                                        
| 609 | - $out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n";  | 
                                                        |
| 610 | - $out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n";  | 
                                                        |
| 609 | + $out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n";  | 
                                                        |
| 610 | + $out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n";  | 
                                                        |
| 611 | 611 | }  | 
                                                        
| 612 | - $out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n";  | 
                                                        |
| 613 | - $out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n";  | 
                                                        |
| 612 | + $out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n";  | 
                                                        |
| 613 | + $out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n";  | 
                                                        |
| 614 | 614 |  		} else { | 
                                                        
| 615 | 615 | $out = $value;  | 
                                                        
| 616 | 616 | }  | 
                                                        
@@ -639,12 +639,12 @@ discard block  | 
                                                    ||
| 639 | 639 | public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)  | 
                                                        
| 640 | 640 |  	{ | 
                                                        
| 641 | 641 |  		if ($incbefore) { | 
                                                        
| 642 | - $text = $incbefore . $text;  | 
                                                        |
| 642 | + $text = $incbefore.$text;  | 
                                                        |
| 643 | 643 | }  | 
                                                        
| 644 | 644 |  		if (!$htmltext) { | 
                                                        
| 645 | 645 | return $text;  | 
                                                        
| 646 | 646 | }  | 
                                                        
| 647 | - $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0  | 
                                                        |
| 647 | + $direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0  | 
                                                        |
| 648 | 648 | |
| 649 | 649 | $tag = 'td';  | 
                                                        
| 650 | 650 |  		if ($notabs == 2) { | 
                                                        
@@ -658,11 +658,11 @@ discard block  | 
                                                    ||
| 658 | 658 | |
| 659 | 659 | $extrastyle = '';  | 
                                                        
| 660 | 660 |  		if ($direction < 0) { | 
                                                        
| 661 | - $extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');  | 
                                                        |
| 661 | + $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');  | 
                                                        |
| 662 | 662 | $extrastyle = 'padding: 0px; padding-left: 2px;';  | 
                                                        
| 663 | 663 | }  | 
                                                        
| 664 | 664 |  		if ($direction > 0) { | 
                                                        
| 665 | - $extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');  | 
                                                        |
| 665 | + $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');  | 
                                                        |
| 666 | 666 | $extrastyle = 'padding: 0px; padding-right: 2px;';  | 
                                                        
| 667 | 667 | }  | 
                                                        
| 668 | 668 | |
@@ -675,53 +675,53 @@ discard block  | 
                                                    ||
| 675 | 675 |  			$htmltext = str_replace('"', '"', $htmltext); | 
                                                        
| 676 | 676 |  		} else { | 
                                                        
| 677 | 677 | $classfortooltip = 'classfortooltiponclick';  | 
                                                        
| 678 | - $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>';  | 
                                                        |
| 678 | + $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>';  | 
                                                        |
| 679 | 679 | }  | 
                                                        
| 680 | 680 |  		if ($tooltipon == 2 || $tooltipon == 3) { | 
                                                        
| 681 | - $paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"';  | 
                                                        |
| 681 | + $paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"';  | 
                                                        |
| 682 | 682 |  			if ($tooltiptrigger == '') { | 
                                                        
| 683 | - $paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip  | 
                                                        |
| 683 | + $paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip  | 
                                                        |
| 684 | 684 |  			} else { | 
                                                        
| 685 | - $paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"';  | 
                                                        |
| 685 | + $paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"';  | 
                                                        |
| 686 | 686 | }  | 
                                                        
| 687 | 687 |  		} else { | 
                                                        
| 688 | - $paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag  | 
                                                        |
| 688 | + $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag  | 
                                                        |
| 689 | 689 | }  | 
                                                        
| 690 | 690 |  		if ($tooltipon == 1 || $tooltipon == 3) { | 
                                                        
| 691 | - $paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" ';  | 
                                                        |
| 691 | + $paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" ';  | 
                                                        |
| 692 | 692 |  			if ($tooltiptrigger == '') { | 
                                                        
| 693 | - $paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip  | 
                                                        |
| 693 | + $paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip  | 
                                                        |
| 694 | 694 |  			} else { | 
                                                        
| 695 | - $paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"';  | 
                                                        |
| 695 | + $paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"';  | 
                                                        |
| 696 | 696 | }  | 
                                                        
| 697 | 697 |  		} else { | 
                                                        
| 698 | - $paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag  | 
                                                        |
| 698 | + $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag  | 
                                                        |
| 699 | 699 | }  | 
                                                        
| 700 | 700 |  		if (empty($notabs)) { | 
                                                        
| 701 | 701 | $s .= '<table class="nobordernopadding"><tr style="height: auto;">';  | 
                                                        
| 702 | 702 |  		} elseif ($notabs == 2) { | 
                                                        
| 703 | - $s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">';  | 
                                                        |
| 703 | + $s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">';  | 
                                                        |
| 704 | 704 | }  | 
                                                        
| 705 | 705 | // Define value if value is before  | 
                                                        
| 706 | 706 |  		if ($direction < 0) { | 
                                                        
| 707 | - $s .= '<' . $tag . $paramfortooltipimg;  | 
                                                        |
| 707 | + $s .= '<'.$tag.$paramfortooltipimg;  | 
                                                        |
| 708 | 708 |  			if ($tag == 'td') { | 
                                                        
| 709 | 709 | $s .= ' class="valigntop" width="14"';  | 
                                                        
| 710 | 710 | }  | 
                                                        
| 711 | - $s .= '>' . $textfordialog . $img . '</' . $tag . '>';  | 
                                                        |
| 711 | + $s .= '>'.$textfordialog.$img.'</'.$tag.'>';  | 
                                                        |
| 712 | 712 | }  | 
                                                        
| 713 | 713 | // Use another method to help avoid having a space in value in order to use this value with jquery  | 
                                                        
| 714 | 714 | // Define label  | 
                                                        
| 715 | 715 |  		if ((string) $text != '') { | 
                                                        
| 716 | - $s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>';  | 
                                                        |
| 716 | + $s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';  | 
                                                        |
| 717 | 717 | }  | 
                                                        
| 718 | 718 | // Define value if value is after  | 
                                                        
| 719 | 719 |  		if ($direction > 0) { | 
                                                        
| 720 | - $s .= '<' . $tag . $paramfortooltipimg;  | 
                                                        |
| 720 | + $s .= '<'.$tag.$paramfortooltipimg;  | 
                                                        |
| 721 | 721 |  			if ($tag == 'td') { | 
                                                        
| 722 | 722 | $s .= ' class="valignmiddle" width="14"';  | 
                                                        
| 723 | 723 | }  | 
                                                        
| 724 | - $s .= '>' . $textfordialog . $img . '</' . $tag . '>';  | 
                                                        |
| 724 | + $s .= '>'.$textfordialog.$img.'</'.$tag.'>';  | 
                                                        |
| 725 | 725 | }  | 
                                                        
| 726 | 726 |  		if (empty($notabs)) { | 
                                                        
| 727 | 727 | $s .= '</tr></table>';  | 
                                                        
@@ -828,7 +828,7 @@ discard block  | 
                                                    ||
| 828 | 828 | |
| 829 | 829 | $disabled = 0;  | 
                                                        
| 830 | 830 | $ret = '<div class="centpercent center">';  | 
                                                        
| 831 | - $ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>';  | 
                                                        |
| 831 | + $ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>';  | 
                                                        |
| 832 | 832 | |
| 833 | 833 | // Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks.  | 
                                                        
| 834 | 834 | $parameters = array();  | 
                                                        
@@ -839,10 +839,10 @@ discard block  | 
                                                    ||
| 839 | 839 | return;  | 
                                                        
| 840 | 840 | }  | 
                                                        
| 841 | 841 |  		if (empty($reshook)) { | 
                                                        
| 842 | -			$ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>'; | 
                                                        |
| 842 | +			$ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>'; | 
                                                        |
| 843 | 843 |  			if (is_array($arrayofaction)) { | 
                                                        
| 844 | 844 |  				foreach ($arrayofaction as $code => $label) { | 
                                                        
| 845 | - $ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>';  | 
                                                        |
| 845 | + $ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>';  | 
                                                        |
| 846 | 846 | }  | 
                                                        
| 847 | 847 | }  | 
                                                        
| 848 | 848 | }  | 
                                                        
@@ -851,17 +851,17 @@ discard block  | 
                                                    ||
| 851 | 851 | $ret .= '</select>';  | 
                                                        
| 852 | 852 | |
| 853 | 853 |  		if (empty($conf->dol_optimize_smallscreen)) { | 
                                                        
| 854 | -			$ret .= ajax_combobox('.' . $name . 'select'); | 
                                                        |
| 854 | +			$ret .= ajax_combobox('.'.$name.'select'); | 
                                                        |
| 855 | 855 | }  | 
                                                        
| 856 | 856 | |
| 857 | 857 | // Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button  | 
                                                        
| 858 | 858 | $ret .= '<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER.  | 
                                                        
| 859 | -		$ret .= '<input type="submit" disabled name="confirmmassaction"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display: none"') . ' class="reposition button smallpaddingimp' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'confirmed" value="' . dol_escape_htmltag($langs->trans("Confirm")) . '">'; | 
                                                        |
| 859 | +		$ret .= '<input type="submit" disabled name="confirmmassaction"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display: none"').' class="reposition button smallpaddingimp'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">'; | 
                                                        |
| 860 | 860 | $ret .= '</div>';  | 
                                                        
| 861 | 861 | |
| 862 | 862 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 863 | 863 | $ret .= '<!-- JS CODE TO ENABLE mass action select -->  | 
                                                        
| 864 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 864 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 865 | 865 | function initCheckForSelect(mode, name, cssclass) /* mode is 0 during init of page or click all, 1 when we click on 1 checkboxi, "name" refers to the class of the massaction button, "cssclass" to the class of the checkfor select boxes */  | 
                                                        
| 866 | 866 |          		{ | 
                                                        
| 867 | 867 | atleastoneselected=0;  | 
                                                        
@@ -872,11 +872,11 @@ discard block  | 
                                                    ||
| 872 | 872 | |
| 873 | 873 |  					console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected); | 
                                                        
| 874 | 874 | |
| 875 | - if (atleastoneselected || ' . $alwaysvisible . ')  | 
                                                        |
| 875 | + if (atleastoneselected || ' . $alwaysvisible.')  | 
                                                        |
| 876 | 876 |      	  			{ | 
                                                        
| 877 | 877 |                                      jQuery("."+name).show(); | 
                                                        
| 878 | -        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . ' | 
                                                        |
| 879 | -        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . ' | 
                                                        |
| 878 | +        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').' | 
                                                        |
| 879 | +        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').' | 
                                                        |
| 880 | 880 | }  | 
                                                        
| 881 | 881 | else  | 
                                                        
| 882 | 882 |      	  			{ | 
                                                        
@@ -886,11 +886,11 @@ discard block  | 
                                                    ||
| 886 | 886 | }  | 
                                                        
| 887 | 887 | |
| 888 | 888 |          	jQuery(document).ready(function () { | 
                                                        
| 889 | - initCheckForSelect(0, "' . $name . '", "' . $cssclass . '");  | 
                                                        |
| 890 | -                    jQuery(".' . $cssclass . '").click(function() { | 
                                                        |
| 891 | - initCheckForSelect(1, "' . $name . '", "' . $cssclass . '");  | 
                                                        |
| 889 | + initCheckForSelect(0, "' . $name.'", "'.$cssclass.'");  | 
                                                        |
| 890 | +                    jQuery(".' . $cssclass.'").click(function() { | 
                                                        |
| 891 | + initCheckForSelect(1, "' . $name.'", "'.$cssclass.'");  | 
                                                        |
| 892 | 892 | });  | 
                                                        
| 893 | -                        jQuery(".' . $name . 'select").change(function() { | 
                                                        |
| 893 | +                        jQuery(".' . $name.'select").change(function() { | 
                                                        |
| 894 | 894 | var massaction = $( this ).val();  | 
                                                        
| 895 | 895 |          			var urlform = $( this ).closest("form").attr("action").replace("#show_files",""); | 
                                                        
| 896 | 896 | if (massaction == "builddoc")  | 
                                                        
@@ -898,18 +898,18 @@ discard block  | 
                                                    ||
| 898 | 898 | urlform = urlform + "#show_files";  | 
                                                        
| 899 | 899 | }  | 
                                                        
| 900 | 900 |          			$( this ).closest("form").attr("action", urlform); | 
                                                        
| 901 | -                    console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform); | 
                                                        |
| 901 | +                    console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform); | 
                                                        |
| 902 | 902 | /* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */  | 
                                                        
| 903 | 903 | if ($(this).val() != \'0\')  | 
                                                        
| 904 | 904 |      	  			{ | 
                                                        
| 905 | -                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', false); | 
                                                        |
| 906 | -										jQuery(".' . $name . 'other").hide();	/* To disable if another div was open */ | 
                                                        |
| 907 | -                                        jQuery(".' . $name . '"+massaction).show(); | 
                                                        |
| 905 | +                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', false); | 
                                                        |
| 906 | +										jQuery(".' . $name.'other").hide();	/* To disable if another div was open */ | 
                                                        |
| 907 | +                                        jQuery(".' . $name.'"+massaction).show(); | 
                                                        |
| 908 | 908 | }  | 
                                                        
| 909 | 909 | else  | 
                                                        
| 910 | 910 |      	  			{ | 
                                                        
| 911 | -                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', true); | 
                                                        |
| 912 | -										jQuery(".' . $name . 'other").hide();	/* To disable any div open */ | 
                                                        |
| 911 | +                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', true); | 
                                                        |
| 912 | +										jQuery(".' . $name.'other").hide();	/* To disable any div open */ | 
                                                        |
| 913 | 913 | }  | 
                                                        
| 914 | 914 | });  | 
                                                        
| 915 | 915 | });  | 
                                                        
@@ -952,14 +952,14 @@ discard block  | 
                                                    ||
| 952 | 952 | $atleastonefavorite = 0;  | 
                                                        
| 953 | 953 | |
| 954 | 954 | $sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec";  | 
                                                        
| 955 | - $sql .= " FROM " . $this->db->prefix() . "c_country";  | 
                                                        |
| 955 | + $sql .= " FROM ".$this->db->prefix()."c_country";  | 
                                                        |
| 956 | 956 | $sql .= " WHERE active > 0";  | 
                                                        
| 957 | 957 | //$sql.= " ORDER BY code ASC";  | 
                                                        
| 958 | 958 | |
| 959 | - dol_syslog(get_class($this) . "::select_country", LOG_DEBUG);  | 
                                                        |
| 959 | + dol_syslog(get_class($this)."::select_country", LOG_DEBUG);  | 
                                                        |
| 960 | 960 | $resql = $this->db->query($sql);  | 
                                                        
| 961 | 961 |  		if ($resql) { | 
                                                        
| 962 | - $out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>';  | 
                                                        |
| 962 | + $out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>';  | 
                                                        |
| 963 | 963 | $num = $this->db->num_rows($resql);  | 
                                                        
| 964 | 964 | $i = 0;  | 
                                                        
| 965 | 965 |  			if ($num) { | 
                                                        
@@ -969,7 +969,7 @@ discard block  | 
                                                    ||
| 969 | 969 | $countryArray[$i]['rowid'] = $obj->rowid;  | 
                                                        
| 970 | 970 | $countryArray[$i]['code_iso'] = $obj->code_iso;  | 
                                                        
| 971 | 971 | $countryArray[$i]['code_iso3'] = $obj->code_iso3;  | 
                                                        
| 972 | -					$countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 972 | +					$countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 973 | 973 | $countryArray[$i]['favorite'] = $obj->favorite;  | 
                                                        
| 974 | 974 | $countryArray[$i]['eec'] = $obj->eec;  | 
                                                        
| 975 | 975 | $favorite[$i] = $obj->favorite;  | 
                                                        
@@ -987,20 +987,20 @@ discard block  | 
                                                    ||
| 987 | 987 | |
| 988 | 988 |  				if ($showempty) { | 
                                                        
| 989 | 989 |  					if (is_numeric($showempty)) { | 
                                                        
| 990 | - $out .= '<option value=""> </option>' . "\n";  | 
                                                        |
| 990 | + $out .= '<option value=""> </option>'."\n";  | 
                                                        |
| 991 | 991 |  					} else { | 
                                                        
| 992 | - $out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n";  | 
                                                        |
| 992 | + $out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n";  | 
                                                        |
| 993 | 993 | }  | 
                                                        
| 994 | 994 | }  | 
                                                        
| 995 | 995 | |
| 996 | 996 |  				if ($addspecialentries) {    // Add dedicated entries for groups of countries | 
                                                        
| 997 | 997 | //if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';  | 
                                                        
| 998 | -					$out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; | 
                                                        |
| 999 | -					$out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>'; | 
                                                        |
| 998 | +					$out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; | 
                                                        |
| 999 | +					$out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>'; | 
                                                        |
| 1000 | 1000 |  					if ($mysoc->isInEEC()) { | 
                                                        
| 1001 | -						$out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; | 
                                                        |
| 1001 | +						$out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; | 
                                                        |
| 1002 | 1002 | }  | 
                                                        
| 1003 | -					$out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>'; | 
                                                        |
| 1003 | +					$out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>'; | 
                                                        |
| 1004 | 1004 | $out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>';  | 
                                                        
| 1005 | 1005 | }  | 
                                                        
| 1006 | 1006 | |
@@ -1028,20 +1028,20 @@ discard block  | 
                                                    ||
| 1028 | 1028 | $labeltoshow .= ' ';  | 
                                                        
| 1029 | 1029 | }  | 
                                                        
| 1030 | 1030 |  					if ($row['code_iso']) { | 
                                                        
| 1031 | -						$labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>'; | 
                                                        |
| 1031 | +						$labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>'; | 
                                                        |
| 1032 | 1032 |  						if (empty($hideflags)) { | 
                                                        
| 1033 | 1033 | $tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1);  | 
                                                        
| 1034 | - $labeltoshow = $tmpflag . ' ' . $labeltoshow;  | 
                                                        |
| 1034 | + $labeltoshow = $tmpflag.' '.$labeltoshow;  | 
                                                        |
| 1035 | 1035 | }  | 
                                                        
| 1036 | 1036 | }  | 
                                                        
| 1037 | 1037 | |
| 1038 | 1038 |  					if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) { | 
                                                        
| 1039 | - $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">';  | 
                                                        |
| 1039 | + $out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" selected data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">';  | 
                                                        |
| 1040 | 1040 |  					} else { | 
                                                        
| 1041 | - $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">';  | 
                                                        |
| 1041 | + $out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">';  | 
                                                        |
| 1042 | 1042 | }  | 
                                                        
| 1043 | 1043 | $out .= $labeltoshow;  | 
                                                        
| 1044 | - $out .= '</option>' . "\n";  | 
                                                        |
| 1044 | + $out .= '</option>'."\n";  | 
                                                        |
| 1045 | 1045 | }  | 
                                                        
| 1046 | 1046 | }  | 
                                                        
| 1047 | 1047 | $out .= '</select>';  | 
                                                        
@@ -1050,8 +1050,8 @@ discard block  | 
                                                    ||
| 1050 | 1050 | }  | 
                                                        
| 1051 | 1051 | |
| 1052 | 1052 | // Make select dynamic  | 
                                                        
| 1053 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1054 | -		$out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve'); | 
                                                        |
| 1053 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1054 | +		$out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve'); | 
                                                        |
| 1055 | 1055 | |
| 1056 | 1056 | return $out;  | 
                                                        
| 1057 | 1057 | }  | 
                                                        
@@ -1083,25 +1083,25 @@ discard block  | 
                                                    ||
| 1083 | 1083 | $incotermArray = array();  | 
                                                        
| 1084 | 1084 | |
| 1085 | 1085 | $sql = "SELECT rowid, code";  | 
                                                        
| 1086 | - $sql .= " FROM " . $this->db->prefix() . "c_incoterms";  | 
                                                        |
| 1086 | + $sql .= " FROM ".$this->db->prefix()."c_incoterms";  | 
                                                        |
| 1087 | 1087 | $sql .= " WHERE active > 0";  | 
                                                        
| 1088 | 1088 | $sql .= " ORDER BY code ASC";  | 
                                                        
| 1089 | 1089 | |
| 1090 | - dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG);  | 
                                                        |
| 1090 | + dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);  | 
                                                        |
| 1091 | 1091 | $resql = $this->db->query($sql);  | 
                                                        
| 1092 | 1092 |  		if ($resql) { | 
                                                        
| 1093 | 1093 |  			if ($conf->use_javascript_ajax && !$forcecombo) { | 
                                                        
| 1094 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1094 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1095 | 1095 | $out .= ajax_combobox($htmlname, $events);  | 
                                                        
| 1096 | 1096 | }  | 
                                                        
| 1097 | 1097 | |
| 1098 | 1098 |  			if (!empty($page)) { | 
                                                        
| 1099 | - $out .= '<form method="post" action="' . $page . '">';  | 
                                                        |
| 1099 | + $out .= '<form method="post" action="'.$page.'">';  | 
                                                        |
| 1100 | 1100 | $out .= '<input type="hidden" name="action" value="set_incoterms">';  | 
                                                        
| 1101 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 1101 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 1102 | 1102 | }  | 
                                                        
| 1103 | 1103 | |
| 1104 | - $out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>';  | 
                                                        |
| 1104 | + $out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>';  | 
                                                        |
| 1105 | 1105 | $out .= '<option value="0"> </option>';  | 
                                                        
| 1106 | 1106 | $num = $this->db->num_rows($resql);  | 
                                                        
| 1107 | 1107 | $i = 0;  | 
                                                        
@@ -1115,9 +1115,9 @@ discard block  | 
                                                    ||
| 1115 | 1115 | |
| 1116 | 1116 |  				foreach ($incotermArray as $row) { | 
                                                        
| 1117 | 1117 |  					if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) { | 
                                                        
| 1118 | - $out .= '<option value="' . $row['rowid'] . '" selected>';  | 
                                                        |
| 1118 | + $out .= '<option value="'.$row['rowid'].'" selected>';  | 
                                                        |
| 1119 | 1119 |  					} else { | 
                                                        
| 1120 | - $out .= '<option value="' . $row['rowid'] . '">';  | 
                                                        |
| 1120 | + $out .= '<option value="'.$row['rowid'].'">';  | 
                                                        |
| 1121 | 1121 | }  | 
                                                        
| 1122 | 1122 | |
| 1123 | 1123 |  					if ($row['code']) { | 
                                                        
@@ -1130,13 +1130,13 @@ discard block  | 
                                                    ||
| 1130 | 1130 | $out .= '</select>';  | 
                                                        
| 1131 | 1131 | |
| 1132 | 1132 |  			if ($conf->use_javascript_ajax && empty($disableautocomplete)) { | 
                                                        
| 1133 | -				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n"; | 
                                                        |
| 1133 | +				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; | 
                                                        |
| 1134 | 1134 | $moreattrib .= ' autocomplete="off"';  | 
                                                        
| 1135 | 1135 | }  | 
                                                        
| 1136 | - $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n";  | 
                                                        |
| 1136 | + $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n";  | 
                                                        |
| 1137 | 1137 | |
| 1138 | 1138 |  			if (!empty($page)) { | 
                                                        
| 1139 | -				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>'; | 
                                                        |
| 1139 | +				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>'; | 
                                                        |
| 1140 | 1140 | }  | 
                                                        
| 1141 | 1141 |  		} else { | 
                                                        
| 1142 | 1142 | dol_print_error($this->db);  | 
                                                        
@@ -1168,9 +1168,9 @@ discard block  | 
                                                    ||
| 1168 | 1168 |  		if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service")) | 
                                                        
| 1169 | 1169 |  			|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) { | 
                                                        
| 1170 | 1170 |  			if (empty($hidetext)) { | 
                                                        
| 1171 | -				print $langs->trans("Type") . ': '; | 
                                                        |
| 1171 | +				print $langs->trans("Type").': '; | 
                                                        |
| 1172 | 1172 | }  | 
                                                        
| 1173 | - print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 1173 | + print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 1174 | 1174 |  			if ($showempty) { | 
                                                        
| 1175 | 1175 | print '<option value="-1"';  | 
                                                        
| 1176 | 1176 |  				if ($selected == -1) { | 
                                                        
@@ -1189,28 +1189,28 @@ discard block  | 
                                                    ||
| 1189 | 1189 |  			if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) { | 
                                                        
| 1190 | 1190 | print ' selected';  | 
                                                        
| 1191 | 1191 | }  | 
                                                        
| 1192 | -			print '>' . $langs->trans("Product"); | 
                                                        |
| 1192 | +			print '>'.$langs->trans("Product"); | 
                                                        |
| 1193 | 1193 | |
| 1194 | 1194 | print '<option value="1"';  | 
                                                        
| 1195 | 1195 |  			if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) { | 
                                                        
| 1196 | 1196 | print ' selected';  | 
                                                        
| 1197 | 1197 | }  | 
                                                        
| 1198 | -			print '>' . $langs->trans("Service"); | 
                                                        |
| 1198 | +			print '>'.$langs->trans("Service"); | 
                                                        |
| 1199 | 1199 | |
| 1200 | 1200 | print '</select>';  | 
                                                        
| 1201 | -			print ajax_combobox('select_' . $htmlname); | 
                                                        |
| 1201 | +			print ajax_combobox('select_'.$htmlname); | 
                                                        |
| 1202 | 1202 |  			//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); | 
                                                        
| 1203 | 1203 | }  | 
                                                        
| 1204 | 1204 |  		if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) { | 
                                                        
| 1205 | 1205 |  			print $langs->trans("Service"); | 
                                                        
| 1206 | - print '<input type="hidden" name="' . $htmlname . '" value="1">';  | 
                                                        |
| 1206 | + print '<input type="hidden" name="'.$htmlname.'" value="1">';  | 
                                                        |
| 1207 | 1207 | }  | 
                                                        
| 1208 | 1208 |  		if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) { | 
                                                        
| 1209 | 1209 |  			print $langs->trans("Product"); | 
                                                        
| 1210 | - print '<input type="hidden" name="' . $htmlname . '" value="0">';  | 
                                                        |
| 1210 | + print '<input type="hidden" name="'.$htmlname.'" value="0">';  | 
                                                        |
| 1211 | 1211 | }  | 
                                                        
| 1212 | 1212 |  		if ($forceall < 0) {    // This should happened only for contracts when both predefined product and service are disabled. | 
                                                        
| 1213 | - print '<input type="hidden" name="' . $htmlname . '" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1  | 
                                                        |
| 1213 | + print '<input type="hidden" name="'.$htmlname.'" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1  | 
                                                        |
| 1214 | 1214 | }  | 
                                                        
| 1215 | 1215 | }  | 
                                                        
| 1216 | 1216 | |
@@ -1236,7 +1236,7 @@ discard block  | 
                                                    ||
| 1236 | 1236 |  		$langs->load("trips"); | 
                                                        
| 1237 | 1237 | |
| 1238 | 1238 | $sql = "SELECT c.code, c.label";  | 
                                                        
| 1239 | - $sql .= " FROM " . $this->db->prefix() . "c_type_fees as c";  | 
                                                        |
| 1239 | + $sql .= " FROM ".$this->db->prefix()."c_type_fees as c";  | 
                                                        |
| 1240 | 1240 | $sql .= " WHERE active > 0";  | 
                                                        
| 1241 | 1241 | |
| 1242 | 1242 | $resql = $this->db->query($sql);  | 
                                                        
@@ -1277,11 +1277,11 @@ discard block  | 
                                                    ||
| 1277 | 1277 | // phpcs:enable  | 
                                                        
| 1278 | 1278 | global $user, $langs;  | 
                                                        
| 1279 | 1279 | |
| 1280 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 1280 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 1281 | 1281 | |
| 1282 | 1282 | $this->load_cache_types_fees();  | 
                                                        
| 1283 | 1283 | |
| 1284 | - print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">';  | 
                                                        |
| 1284 | + print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">';  | 
                                                        |
| 1285 | 1285 |  		if ($showempty) { | 
                                                        
| 1286 | 1286 | print '<option value="-1"';  | 
                                                        
| 1287 | 1287 |  			if ($selected == -1) { | 
                                                        
@@ -1291,7 +1291,7 @@ discard block  | 
                                                    ||
| 1291 | 1291 | }  | 
                                                        
| 1292 | 1292 | |
| 1293 | 1293 |  		foreach ($this->cache_types_fees as $key => $value) { | 
                                                        
| 1294 | - print '<option value="' . $key . '"';  | 
                                                        |
| 1294 | + print '<option value="'.$key.'"';  | 
                                                        |
| 1295 | 1295 |  			if ($key == $selected) { | 
                                                        
| 1296 | 1296 | print ' selected';  | 
                                                        
| 1297 | 1297 | }  | 
                                                        
@@ -1343,12 +1343,12 @@ discard block  | 
                                                    ||
| 1343 | 1343 | $ajaxoptions = array();  | 
                                                        
| 1344 | 1344 | }  | 
                                                        
| 1345 | 1345 | |
| 1346 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1346 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1347 | 1347 | |
| 1348 | 1348 | // No immediate load of all database  | 
                                                        
| 1349 | 1349 | $placeholder = '';  | 
                                                        
| 1350 | 1350 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 1351 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        |
| 1351 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        |
| 1352 | 1352 | $societetmp = new Societe($this->db);  | 
                                                        
| 1353 | 1353 | $societetmp->fetch($selected);  | 
                                                        
| 1354 | 1354 | $selected_input_value = $societetmp->name;  | 
                                                        
@@ -1356,18 +1356,18 @@ discard block  | 
                                                    ||
| 1356 | 1356 | }  | 
                                                        
| 1357 | 1357 | |
| 1358 | 1358 | // mode 1  | 
                                                        
| 1359 | -			$urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($excludeids) ? '' : '&excludeids=' . implode(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode((string) ($showtype)) : '') . ($showcode ? '&showcode=' . urlencode((string) ($showcode)) : ''); | 
                                                        |
| 1359 | +			$urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($excludeids) ? '' : '&excludeids='.implode(',', $excludeids)).($showtype ? '&showtype='.urlencode((string) ($showtype)) : '').($showcode ? '&showcode='.urlencode((string) ($showcode)) : ''); | 
                                                        |
| 1360 | 1360 | |
| 1361 | 1361 |  			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                        
| 1362 | 1362 |  			if (empty($hidelabel)) { | 
                                                        
| 1363 | -				print $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 1363 | +				print $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 1364 | 1364 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 1365 | 1365 |  				$placeholder = $langs->trans("RefOrLabel"); | 
                                                        
| 1366 | 1366 |  				if ($hidelabel == 2) { | 
                                                        
| 1367 | 1367 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 1368 | 1368 | }  | 
                                                        
| 1369 | 1369 | }  | 
                                                        
| 1370 | -			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 1370 | +			$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 1371 | 1371 |  			if ($hidelabel == 3) { | 
                                                        
| 1372 | 1372 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 1373 | 1373 | }  | 
                                                        
@@ -1429,12 +1429,12 @@ discard block  | 
                                                    ||
| 1429 | 1429 | $events = array();  | 
                                                        
| 1430 | 1430 | }  | 
                                                        
| 1431 | 1431 | |
| 1432 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1432 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1433 | 1433 | |
| 1434 | 1434 | // No immediate load of all database  | 
                                                        
| 1435 | 1435 | $placeholder = '';  | 
                                                        
| 1436 | 1436 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 1437 | - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';  | 
                                                        |
| 1437 | + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';  | 
                                                        |
| 1438 | 1438 | $contacttmp = new Contact($this->db);  | 
                                                        
| 1439 | 1439 | $contacttmp->fetch($selected);  | 
                                                        
| 1440 | 1440 | $selected_input_value = $contacttmp->getFullName($langs);  | 
                                                        
@@ -1445,11 +1445,11 @@ discard block  | 
                                                    ||
| 1445 | 1445 | }  | 
                                                        
| 1446 | 1446 | |
| 1447 | 1447 | // mode 1  | 
                                                        
| 1448 | -			$urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($exclude) ? '' : '&exclude=' . urlencode($exclude)) . ($showsoc ? '&showsoc=' . urlencode((string) ($showsoc)) : ''); | 
                                                        |
| 1448 | +			$urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($exclude) ? '' : '&exclude='.urlencode($exclude)).($showsoc ? '&showsoc='.urlencode((string) ($showsoc)) : ''); | 
                                                        |
| 1449 | 1449 | |
| 1450 | 1450 |  			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                        
| 1451 | 1451 | |
| 1452 | -			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 1452 | +			$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 1453 | 1453 | |
| 1454 | 1454 | $out .= ajax_event($htmlname, $events);  | 
                                                        
| 1455 | 1455 | |
@@ -1546,30 +1546,30 @@ discard block  | 
                                                    ||
| 1546 | 1546 | $sql .= ", s.address, s.zip, s.town";  | 
                                                        
| 1547 | 1547 | $sql .= ", dictp.code as country_code";  | 
                                                        
| 1548 | 1548 | }  | 
                                                        
| 1549 | - $sql .= " FROM " . $this->db->prefix() . "societe as s";  | 
                                                        |
| 1549 | + $sql .= " FROM ".$this->db->prefix()."societe as s";  | 
                                                        |
| 1550 | 1550 |  		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { | 
                                                        
| 1551 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";  | 
                                                        |
| 1551 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";  | 
                                                        |
| 1552 | 1552 | }  | 
                                                        
| 1553 | 1553 |  		if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 1554 | - $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";  | 
                                                        |
| 1554 | + $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";  | 
                                                        |
| 1555 | 1555 | }  | 
                                                        
| 1556 | -		$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; | 
                                                        |
| 1556 | +		$sql .= " WHERE s.entity IN (".getEntity('societe').")"; | 
                                                        |
| 1557 | 1557 |  		if (!empty($user->socid)) { | 
                                                        
| 1558 | - $sql .= " AND s.rowid = " . ((int) $user->socid);  | 
                                                        |
| 1558 | + $sql .= " AND s.rowid = ".((int) $user->socid);  | 
                                                        |
| 1559 | 1559 | }  | 
                                                        
| 1560 | 1560 |  		if ($filter) { | 
                                                        
| 1561 | 1561 |  			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() | 
                                                        
| 1562 | 1562 | // if not, by testSqlAndScriptInject() only.  | 
                                                        
| 1563 | -			$sql .= " AND (" . $filter . ")"; | 
                                                        |
| 1563 | +			$sql .= " AND (".$filter.")"; | 
                                                        |
| 1564 | 1564 | }  | 
                                                        
| 1565 | 1565 |  		if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 1566 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);  | 
                                                        |
| 1566 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);  | 
                                                        |
| 1567 | 1567 | }  | 
                                                        
| 1568 | 1568 |  		if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) { | 
                                                        
| 1569 | 1569 | $sql .= " AND s.status <> 0";  | 
                                                        
| 1570 | 1570 | }  | 
                                                        
| 1571 | 1571 |  		if (!empty($excludeids)) { | 
                                                        
| 1572 | -			$sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")"; | 
                                                        |
| 1572 | +			$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")"; | 
                                                        |
| 1573 | 1573 | }  | 
                                                        
| 1574 | 1574 | // Add where from hooks  | 
                                                        
| 1575 | 1575 | $parameters = array();  | 
                                                        
@@ -1589,17 +1589,17 @@ discard block  | 
                                                    ||
| 1589 | 1589 |  				if ($i > 0) { | 
                                                        
| 1590 | 1590 | $sql .= " AND ";  | 
                                                        
| 1591 | 1591 | }  | 
                                                        
| 1592 | - $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";  | 
                                                        |
| 1592 | + $sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";  | 
                                                        |
| 1593 | 1593 | $i++;  | 
                                                        
| 1594 | 1594 | }  | 
                                                        
| 1595 | 1595 |  			if (count($search_crit) > 1) { | 
                                                        
| 1596 | 1596 | $sql .= ")";  | 
                                                        
| 1597 | 1597 | }  | 
                                                        
| 1598 | 1598 |  			if (isModEnabled('barcode')) { | 
                                                        
| 1599 | - $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 1599 | + $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 1600 | 1600 | }  | 
                                                        
| 1601 | - $sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 1602 | - $sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 1601 | + $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 1602 | + $sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 1603 | 1603 | $sql .= ")";  | 
                                                        
| 1604 | 1604 | }  | 
                                                        
| 1605 | 1605 |  		$sql .= $this->db->order("nom", "ASC"); | 
                                                        
@@ -1610,7 +1610,7 @@ discard block  | 
                                                    ||
| 1610 | 1610 | $resql = $this->db->query($sql);  | 
                                                        
| 1611 | 1611 |  		if ($resql) { | 
                                                        
| 1612 | 1612 | // Construct $out and $outarray  | 
                                                        
| 1613 | - $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";  | 
                                                        |
| 1613 | + $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";  | 
                                                        |
| 1614 | 1614 | |
| 1615 | 1615 | $textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : '');  | 
                                                        
| 1616 | 1616 |  			if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) { | 
                                                        
@@ -1623,7 +1623,7 @@ discard block  | 
                                                    ||
| 1623 | 1623 | }  | 
                                                        
| 1624 | 1624 | }  | 
                                                        
| 1625 | 1625 |  			if ($showempty) { | 
                                                        
| 1626 | -				$out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : ' ') . '</span>') . '">' . $textifempty . '</option>' . "\n"; | 
                                                        |
| 1626 | +				$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n"; | 
                                                        |
| 1627 | 1627 | }  | 
                                                        
| 1628 | 1628 | |
| 1629 | 1629 | $companytemp = new Societe($this->db);  | 
                                                        
@@ -1636,18 +1636,18 @@ discard block  | 
                                                    ||
| 1636 | 1636 | $label = '';  | 
                                                        
| 1637 | 1637 |  					if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { | 
                                                        
| 1638 | 1638 |  						if (($obj->client) && (!empty($obj->code_client))) { | 
                                                        
| 1639 | - $label = $obj->code_client . ' - ';  | 
                                                        |
| 1639 | + $label = $obj->code_client.' - ';  | 
                                                        |
| 1640 | 1640 | }  | 
                                                        
| 1641 | 1641 |  						if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { | 
                                                        
| 1642 | - $label .= $obj->code_fournisseur . ' - ';  | 
                                                        |
| 1642 | + $label .= $obj->code_fournisseur.' - ';  | 
                                                        |
| 1643 | 1643 | }  | 
                                                        
| 1644 | - $label .= ' ' . $obj->name;  | 
                                                        |
| 1644 | + $label .= ' '.$obj->name;  | 
                                                        |
| 1645 | 1645 |  					} else { | 
                                                        
| 1646 | 1646 | $label = $obj->name;  | 
                                                        
| 1647 | 1647 | }  | 
                                                        
| 1648 | 1648 | |
| 1649 | 1649 |  					if (!empty($obj->name_alias)) { | 
                                                        
| 1650 | -						$label .= ' (' . $obj->name_alias . ')'; | 
                                                        |
| 1650 | +						$label .= ' ('.$obj->name_alias.')'; | 
                                                        |
| 1651 | 1651 | }  | 
                                                        
| 1652 | 1652 | |
| 1653 | 1653 |  					if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) { | 
                                                        
@@ -1662,7 +1662,7 @@ discard block  | 
                                                    ||
| 1662 | 1662 | $companytemp->fournisseur = $obj->fournisseur;  | 
                                                        
| 1663 | 1663 | $tmptype = $companytemp->getTypeUrl(1, '', 0, 'span');  | 
                                                        
| 1664 | 1664 |  						if ($tmptype) { | 
                                                        
| 1665 | - $labelhtml .= ' ' . $tmptype;  | 
                                                        |
| 1665 | + $labelhtml .= ' '.$tmptype;  | 
                                                        |
| 1666 | 1666 | }  | 
                                                        
| 1667 | 1667 | |
| 1668 | 1668 |  						if ($obj->client || $obj->fournisseur) { | 
                                                        
@@ -1672,10 +1672,10 @@ discard block  | 
                                                    ||
| 1672 | 1672 |  							$label .= $langs->trans("Customer"); | 
                                                        
| 1673 | 1673 | }  | 
                                                        
| 1674 | 1674 |  						if ($obj->client == 2 || $obj->client == 3) { | 
                                                        
| 1675 | -							$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); | 
                                                        |
| 1675 | +							$label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); | 
                                                        |
| 1676 | 1676 | }  | 
                                                        
| 1677 | 1677 |  						if ($obj->fournisseur) { | 
                                                        
| 1678 | -							$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); | 
                                                        |
| 1678 | +							$label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); | 
                                                        |
| 1679 | 1679 | }  | 
                                                        
| 1680 | 1680 |  						if ($obj->client || $obj->fournisseur) { | 
                                                        
| 1681 | 1681 | $label .= ')';  | 
                                                        
@@ -1683,9 +1683,9 @@ discard block  | 
                                                    ||
| 1683 | 1683 | }  | 
                                                        
| 1684 | 1684 | |
| 1685 | 1685 |  					if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { | 
                                                        
| 1686 | - $s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : '');  | 
                                                        |
| 1686 | + $s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');  | 
                                                        |
| 1687 | 1687 |  						if (!empty($obj->country_code)) { | 
                                                        
| 1688 | -							$s .= ', ' . $langs->trans('Country' . $obj->country_code); | 
                                                        |
| 1688 | +							$s .= ', '.$langs->trans('Country'.$obj->country_code); | 
                                                        |
| 1689 | 1689 | }  | 
                                                        
| 1690 | 1690 | $label .= $s;  | 
                                                        
| 1691 | 1691 | $labelhtml .= $s;  | 
                                                        
@@ -1693,9 +1693,9 @@ discard block  | 
                                                    ||
| 1693 | 1693 | |
| 1694 | 1694 |  					if (empty($outputmode)) { | 
                                                        
| 1695 | 1695 |  						if (in_array($obj->rowid, $selected)) { | 
                                                        
| 1696 | - $out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';  | 
                                                        |
| 1696 | + $out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';  | 
                                                        |
| 1697 | 1697 |  						} else { | 
                                                        
| 1698 | - $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';  | 
                                                        |
| 1698 | + $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';  | 
                                                        |
| 1699 | 1699 | }  | 
                                                        
| 1700 | 1700 |  					} else { | 
                                                        
| 1701 | 1701 |  						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml)); | 
                                                        
@@ -1707,9 +1707,9 @@ discard block  | 
                                                    ||
| 1707 | 1707 | }  | 
                                                        
| 1708 | 1708 | }  | 
                                                        
| 1709 | 1709 | }  | 
                                                        
| 1710 | - $out .= '</select>' . "\n";  | 
                                                        |
| 1710 | + $out .= '</select>'."\n";  | 
                                                        |
| 1711 | 1711 |  			if (!$forcecombo) { | 
                                                        
| 1712 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1712 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1713 | 1713 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT")); | 
                                                        
| 1714 | 1714 | }  | 
                                                        
| 1715 | 1715 |  		} else { | 
                                                        
@@ -1798,7 +1798,7 @@ discard block  | 
                                                    ||
| 1798 | 1798 | }  | 
                                                        
| 1799 | 1799 | |
| 1800 | 1800 |  		if (!is_object($hookmanager)) { | 
                                                        
| 1801 | - include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';  | 
                                                        |
| 1801 | + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';  | 
                                                        |
| 1802 | 1802 | $hookmanager = new HookManager($this->db);  | 
                                                        
| 1803 | 1803 | }  | 
                                                        
| 1804 | 1804 | |
@@ -1807,13 +1807,13 @@ discard block  | 
                                                    ||
| 1807 | 1807 |  		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { | 
                                                        
| 1808 | 1808 | $sql .= ", s.nom as company, s.town AS company_town";  | 
                                                        
| 1809 | 1809 | }  | 
                                                        
| 1810 | - $sql .= " FROM " . $this->db->prefix() . "socpeople as sp";  | 
                                                        |
| 1810 | + $sql .= " FROM ".$this->db->prefix()."socpeople as sp";  | 
                                                        |
| 1811 | 1811 |  		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { | 
                                                        
| 1812 | - $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";  | 
                                                        |
| 1812 | + $sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";  | 
                                                        |
| 1813 | 1813 | }  | 
                                                        
| 1814 | -		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; | 
                                                        |
| 1814 | +		$sql .= " WHERE sp.entity IN (".getEntity('contact').")"; | 
                                                        |
| 1815 | 1815 |  		if ($socid > 0 || $socid == -1) { | 
                                                        
| 1816 | - $sql .= " AND sp.fk_soc = " . ((int) $socid);  | 
                                                        |
| 1816 | + $sql .= " AND sp.fk_soc = ".((int) $socid);  | 
                                                        |
| 1817 | 1817 | }  | 
                                                        
| 1818 | 1818 |  		if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { | 
                                                        
| 1819 | 1819 | $sql .= " AND sp.statut <> 0";  | 
                                                        
@@ -1821,7 +1821,7 @@ discard block  | 
                                                    ||
| 1821 | 1821 |  		if ($filter) { | 
                                                        
| 1822 | 1822 |  			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() | 
                                                        
| 1823 | 1823 | // if not, by testSqlAndScriptInject() only.  | 
                                                        
| 1824 | -			$sql .= " AND (" . $filter . ")"; | 
                                                        |
| 1824 | +			$sql .= " AND (".$filter.")"; | 
                                                        |
| 1825 | 1825 | }  | 
                                                        
| 1826 | 1826 | // Add where from hooks  | 
                                                        
| 1827 | 1827 | $parameters = array();  | 
                                                        
@@ -1829,30 +1829,30 @@ discard block  | 
                                                    ||
| 1829 | 1829 | $sql .= $hookmanager->resPrint;  | 
                                                        
| 1830 | 1830 | $sql .= " ORDER BY sp.lastname ASC";  | 
                                                        
| 1831 | 1831 | |
| 1832 | - dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG);  | 
                                                        |
| 1832 | + dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);  | 
                                                        |
| 1833 | 1833 | $resql = $this->db->query($sql);  | 
                                                        
| 1834 | 1834 |  		if ($resql) { | 
                                                        
| 1835 | 1835 | $num = $this->db->num_rows($resql);  | 
                                                        
| 1836 | 1836 | |
| 1837 | 1837 |  			if ($htmlname != 'none' && !$options_only) { | 
                                                        
| 1838 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';  | 
                                                        |
| 1838 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';  | 
                                                        |
| 1839 | 1839 | }  | 
                                                        
| 1840 | 1840 | |
| 1841 | 1841 |  			if ($showempty && !is_numeric($showempty)) { | 
                                                        
| 1842 | 1842 | $textforempty = $showempty;  | 
                                                        
| 1843 | - $out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>';  | 
                                                        |
| 1843 | + $out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';  | 
                                                        |
| 1844 | 1844 |  			} else { | 
                                                        
| 1845 | 1845 |  				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { | 
                                                        
| 1846 | - $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>';  | 
                                                        |
| 1846 | + $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>';  | 
                                                        |
| 1847 | 1847 | }  | 
                                                        
| 1848 | 1848 |  				if ($showempty == 2) { | 
                                                        
| 1849 | -					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; | 
                                                        |
| 1849 | +					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; | 
                                                        |
| 1850 | 1850 | }  | 
                                                        
| 1851 | 1851 | }  | 
                                                        
| 1852 | 1852 | |
| 1853 | 1853 | $i = 0;  | 
                                                        
| 1854 | 1854 |  			if ($num) { | 
                                                        
| 1855 | - include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';  | 
                                                        |
| 1855 | + include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';  | 
                                                        |
| 1856 | 1856 | $contactstatic = new Contact($this->db);  | 
                                                        
| 1857 | 1857 | |
| 1858 | 1858 |  				while ($i < $num) { | 
                                                        
@@ -1888,7 +1888,7 @@ discard block  | 
                                                    ||
| 1888 | 1888 | }  | 
                                                        
| 1889 | 1889 |  						$extendedInfos = implode(' - ', $extendedInfos); | 
                                                        
| 1890 | 1890 |  						if (!empty($extendedInfos)) { | 
                                                        
| 1891 | - $extendedInfos = ' - ' . $extendedInfos;  | 
                                                        |
| 1891 | + $extendedInfos = ' - '.$extendedInfos;  | 
                                                        |
| 1892 | 1892 | }  | 
                                                        
| 1893 | 1893 | }  | 
                                                        
| 1894 | 1894 | |
@@ -1906,35 +1906,35 @@ discard block  | 
                                                    ||
| 1906 | 1906 | $disabled = 1;  | 
                                                        
| 1907 | 1907 | }  | 
                                                        
| 1908 | 1908 |  							if (!empty($selected) && in_array($obj->rowid, $selected)) { | 
                                                        
| 1909 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 1909 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 1910 | 1910 |  								if ($disabled) { | 
                                                        
| 1911 | 1911 | $out .= ' disabled';  | 
                                                        
| 1912 | 1912 | }  | 
                                                        
| 1913 | 1913 | $out .= ' selected>';  | 
                                                        
| 1914 | 1914 | |
| 1915 | - $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        |
| 1915 | + $tmplabel = $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        |
| 1916 | 1916 |  								if ($showfunction && $obj->poste) { | 
                                                        
| 1917 | -									$tmplabel .= ' (' . $obj->poste . ')'; | 
                                                        |
| 1917 | +									$tmplabel .= ' ('.$obj->poste.')'; | 
                                                        |
| 1918 | 1918 | }  | 
                                                        
| 1919 | 1919 |  								if (($showsoc > 0) && $obj->company) { | 
                                                        
| 1920 | -									$tmplabel .= ' - (' . $obj->company . ')'; | 
                                                        |
| 1920 | +									$tmplabel .= ' - ('.$obj->company.')'; | 
                                                        |
| 1921 | 1921 | }  | 
                                                        
| 1922 | 1922 | |
| 1923 | 1923 | $out .= $tmplabel;  | 
                                                        
| 1924 | 1924 | $out .= '</option>';  | 
                                                        
| 1925 | 1925 |  							} else { | 
                                                        
| 1926 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 1926 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 1927 | 1927 |  								if ($disabled) { | 
                                                        
| 1928 | 1928 | $out .= ' disabled';  | 
                                                        
| 1929 | 1929 | }  | 
                                                        
| 1930 | 1930 | $out .= '>';  | 
                                                        
| 1931 | 1931 | |
| 1932 | - $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        |
| 1932 | + $tmplabel = $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        |
| 1933 | 1933 |  								if ($showfunction && $obj->poste) { | 
                                                        
| 1934 | -									$tmplabel .= ' (' . $obj->poste . ')'; | 
                                                        |
| 1934 | +									$tmplabel .= ' ('.$obj->poste.')'; | 
                                                        |
| 1935 | 1935 | }  | 
                                                        
| 1936 | 1936 |  								if (($showsoc > 0) && $obj->company) { | 
                                                        
| 1937 | -									$tmplabel .= ' - (' . $obj->company . ')'; | 
                                                        |
| 1937 | +									$tmplabel .= ' - ('.$obj->company.')'; | 
                                                        |
| 1938 | 1938 | }  | 
                                                        
| 1939 | 1939 | |
| 1940 | 1940 | $out .= $tmplabel;  | 
                                                        
@@ -1942,12 +1942,12 @@ discard block  | 
                                                    ||
| 1942 | 1942 | }  | 
                                                        
| 1943 | 1943 |  						} else { | 
                                                        
| 1944 | 1944 |  							if (in_array($obj->rowid, $selected)) { | 
                                                        
| 1945 | - $tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        |
| 1945 | + $tmplabel = $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        |
| 1946 | 1946 |  								if ($showfunction && $obj->poste) { | 
                                                        
| 1947 | -									$tmplabel .= ' (' . $obj->poste . ')'; | 
                                                        |
| 1947 | +									$tmplabel .= ' ('.$obj->poste.')'; | 
                                                        |
| 1948 | 1948 | }  | 
                                                        
| 1949 | 1949 |  								if (($showsoc > 0) && $obj->company) { | 
                                                        
| 1950 | -									$tmplabel .= ' - (' . $obj->company . ')'; | 
                                                        |
| 1950 | +									$tmplabel .= ' - ('.$obj->company.')'; | 
                                                        |
| 1951 | 1951 | }  | 
                                                        
| 1952 | 1952 | |
| 1953 | 1953 | $out .= $tmplabel;  | 
                                                        
@@ -1962,7 +1962,7 @@ discard block  | 
                                                    ||
| 1962 | 1962 | }  | 
                                                        
| 1963 | 1963 |  			} else { | 
                                                        
| 1964 | 1964 |  				$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); | 
                                                        
| 1965 | - $out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">';  | 
                                                        |
| 1965 | + $out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">';  | 
                                                        |
| 1966 | 1966 | $out .= $labeltoshow;  | 
                                                        
| 1967 | 1967 | $out .= '</option>';  | 
                                                        
| 1968 | 1968 | }  | 
                                                        
@@ -1983,7 +1983,7 @@ discard block  | 
                                                    ||
| 1983 | 1983 | }  | 
                                                        
| 1984 | 1984 | |
| 1985 | 1985 |  			if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { | 
                                                        
| 1986 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1986 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1987 | 1987 |  				$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT")); | 
                                                        
| 1988 | 1988 | }  | 
                                                        
| 1989 | 1989 | |
@@ -2022,18 +2022,18 @@ discard block  | 
                                                    ||
| 2022 | 2022 | // On recherche les remises  | 
                                                        
| 2023 | 2023 | $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";  | 
                                                        
| 2024 | 2024 | $sql .= " re.description, re.fk_facture_source";  | 
                                                        
| 2025 | - $sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";  | 
                                                        |
| 2026 | - $sql .= " WHERE re.fk_soc = " . (int) $socid;  | 
                                                        |
| 2027 | - $sql .= " AND re.entity = " . $conf->entity;  | 
                                                        |
| 2025 | + $sql .= " FROM ".$this->db->prefix()."societe_remise_except as re";  | 
                                                        |
| 2026 | + $sql .= " WHERE re.fk_soc = ".(int) $socid;  | 
                                                        |
| 2027 | + $sql .= " AND re.entity = ".$conf->entity;  | 
                                                        |
| 2028 | 2028 |  		if ($filter) { | 
                                                        
| 2029 | - $sql .= " AND " . $filter;  | 
                                                        |
| 2029 | + $sql .= " AND ".$filter;  | 
                                                        |
| 2030 | 2030 | }  | 
                                                        
| 2031 | 2031 | $sql .= " ORDER BY re.description ASC";  | 
                                                        
| 2032 | 2032 | |
| 2033 | - dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);  | 
                                                        |
| 2033 | + dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);  | 
                                                        |
| 2034 | 2034 | $resql = $this->db->query($sql);  | 
                                                        
| 2035 | 2035 |  		if ($resql) { | 
                                                        
| 2036 | - print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">';  | 
                                                        |
| 2036 | + print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">';  | 
                                                        |
| 2037 | 2037 | $num = $this->db->num_rows($resql);  | 
                                                        
| 2038 | 2038 | |
| 2039 | 2039 | $qualifiedlines = $num;  | 
                                                        
@@ -2071,16 +2071,16 @@ discard block  | 
                                                    ||
| 2071 | 2071 |  					if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { | 
                                                        
| 2072 | 2072 | $tmpfac = new Facture($this->db);  | 
                                                        
| 2073 | 2073 |  						if ($tmpfac->fetch($obj->fk_facture_source) > 0) { | 
                                                        
| 2074 | - $desc = $desc . ' - ' . $tmpfac->ref;  | 
                                                        |
| 2074 | + $desc = $desc.' - '.$tmpfac->ref;  | 
                                                        |
| 2075 | 2075 | }  | 
                                                        
| 2076 | 2076 | }  | 
                                                        
| 2077 | 2077 | |
| 2078 | -					print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; | 
                                                        |
| 2078 | +					print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; | 
                                                        |
| 2079 | 2079 | $i++;  | 
                                                        
| 2080 | 2080 | }  | 
                                                        
| 2081 | 2081 | }  | 
                                                        
| 2082 | 2082 | print '</select>';  | 
                                                        
| 2083 | -			print ajax_combobox('select_' . $htmlname); | 
                                                        |
| 2083 | +			print ajax_combobox('select_'.$htmlname); | 
                                                        |
| 2084 | 2084 | |
| 2085 | 2085 | return $qualifiedlines;  | 
                                                        
| 2086 | 2086 |  		} else { | 
                                                        
@@ -2189,14 +2189,14 @@ discard block  | 
                                                    ||
| 2189 | 2189 |  		if ($showlabelofentity) { | 
                                                        
| 2190 | 2190 | $sql .= ", e.label";  | 
                                                        
| 2191 | 2191 | }  | 
                                                        
| 2192 | - $sql .= " FROM " . $this->db->prefix() . "user as u";  | 
                                                        |
| 2192 | + $sql .= " FROM ".$this->db->prefix()."user as u";  | 
                                                        |
| 2193 | 2193 |  		if ($showlabelofentity) { | 
                                                        
| 2194 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";  | 
                                                        |
| 2194 | + $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";  | 
                                                        |
| 2195 | 2195 | }  | 
                                                        
| 2196 | 2196 | // Condition here should be the same than into societe->getSalesRepresentatives().  | 
                                                        
| 2197 | 2197 |  		if ($userissuperadminentityone && $force_entity != 'default') { | 
                                                        
| 2198 | 2198 |  			if (!empty($force_entity)) { | 
                                                        
| 2199 | - $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";  | 
                                                        |
| 2199 | + $sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";  | 
                                                        |
| 2200 | 2200 |  			} else { | 
                                                        
| 2201 | 2201 | $sql .= " WHERE u.entity IS NOT NULL";  | 
                                                        
| 2202 | 2202 | }  | 
                                                        
@@ -2204,18 +2204,18 @@ discard block  | 
                                                    ||
| 2204 | 2204 |  			if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { | 
                                                        
| 2205 | 2205 |  				$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; | 
                                                        
| 2206 | 2206 |  			} else { | 
                                                        
| 2207 | -				$sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; | 
                                                        |
| 2207 | +				$sql .= " WHERE u.entity IN (".getEntity('user').")"; | 
                                                        |
| 2208 | 2208 | }  | 
                                                        
| 2209 | 2209 | }  | 
                                                        
| 2210 | 2210 | |
| 2211 | 2211 |  		if (!empty($user->socid)) { | 
                                                        
| 2212 | - $sql .= " AND u.fk_soc = " . ((int) $user->socid);  | 
                                                        |
| 2212 | + $sql .= " AND u.fk_soc = ".((int) $user->socid);  | 
                                                        |
| 2213 | 2213 | }  | 
                                                        
| 2214 | 2214 |  		if (is_array($exclude) && $excludeUsers) { | 
                                                        
| 2215 | -			$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; | 
                                                        |
| 2215 | +			$sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; | 
                                                        |
| 2216 | 2216 | }  | 
                                                        
| 2217 | 2217 |  		if ($includeUsers) { | 
                                                        
| 2218 | -			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; | 
                                                        |
| 2218 | +			$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; | 
                                                        |
| 2219 | 2219 | }  | 
                                                        
| 2220 | 2220 |  		if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { | 
                                                        
| 2221 | 2221 | $sql .= " AND u.statut <> 0";  | 
                                                        
@@ -2227,7 +2227,7 @@ discard block  | 
                                                    ||
| 2227 | 2227 | $sql .= " AND u.fk_soc IS NULL";  | 
                                                        
| 2228 | 2228 | }  | 
                                                        
| 2229 | 2229 |  		if (!empty($morefilter)) { | 
                                                        
| 2230 | - $sql .= " " . $morefilter;  | 
                                                        |
| 2230 | + $sql .= " ".$morefilter;  | 
                                                        |
| 2231 | 2231 | }  | 
                                                        
| 2232 | 2232 | |
| 2233 | 2233 | //Add hook to filter on user (for example on usergroup define in custom modules)  | 
                                                        
@@ -2242,7 +2242,7 @@ discard block  | 
                                                    ||
| 2242 | 2242 | $sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";  | 
                                                        
| 2243 | 2243 | }  | 
                                                        
| 2244 | 2244 | |
| 2245 | - dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG);  | 
                                                        |
| 2245 | + dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);  | 
                                                        |
| 2246 | 2246 | |
| 2247 | 2247 | $resql = $this->db->query($sql);  | 
                                                        
| 2248 | 2248 |  		if ($resql) { | 
                                                        
@@ -2250,7 +2250,7 @@ discard block  | 
                                                    ||
| 2250 | 2250 | $i = 0;  | 
                                                        
| 2251 | 2251 |  			if ($num) { | 
                                                        
| 2252 | 2252 | // do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined  | 
                                                        
| 2253 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 2253 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 2254 | 2254 |  				if ($show_empty && !$multiple) { | 
                                                        
| 2255 | 2255 | $textforempty = ' ';  | 
                                                        
| 2256 | 2256 |  					if (!empty($conf->use_javascript_ajax)) { | 
                                                        
@@ -2259,10 +2259,10 @@ discard block  | 
                                                    ||
| 2259 | 2259 |  					if (!is_numeric($show_empty)) { | 
                                                        
| 2260 | 2260 | $textforempty = $show_empty;  | 
                                                        
| 2261 | 2261 | }  | 
                                                        
| 2262 | - $out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";  | 
                                                        |
| 2262 | + $out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n";  | 
                                                        |
| 2263 | 2263 | }  | 
                                                        
| 2264 | 2264 |  				if ($show_every) { | 
                                                        
| 2265 | -					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; | 
                                                        |
| 2265 | +					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; | 
                                                        |
| 2266 | 2266 | }  | 
                                                        
| 2267 | 2267 | |
| 2268 | 2268 | $userstatic = new User($this->db);  | 
                                                        
@@ -2310,21 +2310,21 @@ discard block  | 
                                                    ||
| 2310 | 2310 | }  | 
                                                        
| 2311 | 2311 |  					if ($showstatus >= 0) { | 
                                                        
| 2312 | 2312 |  						if ($obj->status == 1 && $showstatus == 1) { | 
                                                        
| 2313 | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); | 
                                                        |
| 2314 | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); | 
                                                        |
| 2313 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); | 
                                                        |
| 2314 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); | 
                                                        |
| 2315 | 2315 | }  | 
                                                        
| 2316 | 2316 |  						if ($obj->status == 0 && $showstatus == 1) { | 
                                                        
| 2317 | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); | 
                                                        |
| 2318 | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); | 
                                                        |
| 2317 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); | 
                                                        |
| 2318 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); | 
                                                        |
| 2319 | 2319 | }  | 
                                                        
| 2320 | 2320 | }  | 
                                                        
| 2321 | 2321 |  					if ($showlabelofentity) { | 
                                                        
| 2322 | 2322 |  						if (empty($obj->entity)) { | 
                                                        
| 2323 | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); | 
                                                        |
| 2324 | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); | 
                                                        |
| 2323 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); | 
                                                        |
| 2324 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); | 
                                                        |
| 2325 | 2325 |  						} else { | 
                                                        
| 2326 | 2326 |  							if ($obj->entity != $conf->entity) { | 
                                                        
| 2327 | -								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        |
| 2327 | +								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        |
| 2328 | 2328 |  								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        
| 2329 | 2329 | }  | 
                                                        
| 2330 | 2330 | }  | 
                                                        
@@ -2333,13 +2333,13 @@ discard block  | 
                                                    ||
| 2333 | 2333 | $moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : '');  | 
                                                        
| 2334 | 2334 |  					if (!empty($disableline) && $disableline != '1') { | 
                                                        
| 2335 | 2335 | // Add text from $enableonlytext parameter  | 
                                                        
| 2336 | - $moreinfo .= ' - ' . $disableline;  | 
                                                        |
| 2337 | - $moreinfohtml .= ' - ' . $disableline;  | 
                                                        |
| 2336 | + $moreinfo .= ' - '.$disableline;  | 
                                                        |
| 2337 | + $moreinfohtml .= ' - '.$disableline;  | 
                                                        |
| 2338 | 2338 | }  | 
                                                        
| 2339 | 2339 | $labeltoshow .= $moreinfo;  | 
                                                        
| 2340 | 2340 | $labeltoshowhtml .= $moreinfohtml;  | 
                                                        
| 2341 | 2341 | |
| 2342 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 2342 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 2343 | 2343 |  					if (!empty($disableline)) { | 
                                                        
| 2344 | 2344 | $out .= ' disabled';  | 
                                                        
| 2345 | 2345 | }  | 
                                                        
@@ -2348,7 +2348,7 @@ discard block  | 
                                                    ||
| 2348 | 2348 | }  | 
                                                        
| 2349 | 2349 | $out .= ' data-html="';  | 
                                                        
| 2350 | 2350 | |
| 2351 | - $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' ';  | 
                                                        |
| 2351 | + $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';  | 
                                                        |
| 2352 | 2352 |  					if ($showstatus >= 0 && $obj->status == 0) { | 
                                                        
| 2353 | 2353 | $outhtml .= '<strike class="opacitymediumxxx">';  | 
                                                        
| 2354 | 2354 | }  | 
                                                        
@@ -2363,7 +2363,7 @@ discard block  | 
                                                    ||
| 2363 | 2363 | $out .= $labeltoshow;  | 
                                                        
| 2364 | 2364 | $out .= '</option>';  | 
                                                        
| 2365 | 2365 | |
| 2366 | - $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;  | 
                                                        |
| 2366 | + $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;  | 
                                                        |
| 2367 | 2367 | $outarray2[$userstatic->id] = array(  | 
                                                        
| 2368 | 2368 | 'id' => $userstatic->id,  | 
                                                        
| 2369 | 2369 | 'label' => $labeltoshow,  | 
                                                        
@@ -2375,14 +2375,14 @@ discard block  | 
                                                    ||
| 2375 | 2375 | $i++;  | 
                                                        
| 2376 | 2376 | }  | 
                                                        
| 2377 | 2377 |  			} else { | 
                                                        
| 2378 | - $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';  | 
                                                        |
| 2379 | -				$out .= '<option value="">' . $langs->trans("None") . '</option>'; | 
                                                        |
| 2378 | + $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';  | 
                                                        |
| 2379 | +				$out .= '<option value="">'.$langs->trans("None").'</option>'; | 
                                                        |
| 2380 | 2380 | }  | 
                                                        
| 2381 | 2381 | $out .= '</select>';  | 
                                                        
| 2382 | 2382 | |
| 2383 | 2383 |  			if ($num && !$forcecombo) { | 
                                                        
| 2384 | 2384 | // Enhance with select2  | 
                                                        
| 2385 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 2385 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 2386 | 2386 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 2387 | 2387 | }  | 
                                                        
| 2388 | 2388 |  		} else { | 
                                                        
@@ -2458,16 +2458,16 @@ discard block  | 
                                                    ||
| 2458 | 2458 | $out .= $userstatic->getNomUrl(-1);  | 
                                                        
| 2459 | 2459 |  			if ($i == 0) { | 
                                                        
| 2460 | 2460 | $ownerid = $value['id'];  | 
                                                        
| 2461 | -				$out .= ' (' . $langs->trans("Owner") . ')'; | 
                                                        |
| 2461 | +				$out .= ' ('.$langs->trans("Owner").')'; | 
                                                        |
| 2462 | 2462 | }  | 
                                                        
| 2463 | 2463 |  			if ($nbassignetouser > 1 && $action != 'view') { | 
                                                        
| 2464 | -				$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 . '">'; | 
                                                        |
| 2464 | +				$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.'">'; | 
                                                        |
| 2465 | 2465 | }  | 
                                                        
| 2466 | 2466 | // Show my availability  | 
                                                        
| 2467 | 2467 |  			if ($showproperties) { | 
                                                        
| 2468 | 2468 |  				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { | 
                                                        
| 2469 | 2469 | $out .= '<div class="myavailability inline-block">';  | 
                                                        
| 2470 | -					$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>'; | 
                                                        |
| 2470 | +					$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>'; | 
                                                        |
| 2471 | 2471 | $out .= '</div>';  | 
                                                        
| 2472 | 2472 | }  | 
                                                        
| 2473 | 2473 | }  | 
                                                        
@@ -2484,15 +2484,15 @@ discard block  | 
                                                    ||
| 2484 | 2484 | // Method with no ajax  | 
                                                        
| 2485 | 2485 |  		if ($action != 'view') { | 
                                                        
| 2486 | 2486 | $out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';  | 
                                                        
| 2487 | -			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2487 | +			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2488 | 2488 |  			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; | 
                                                        
| 2489 | 2489 |  			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; | 
                                                        
| 2490 | -			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; | 
                                                        |
| 2491 | -			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; | 
                                                        |
| 2490 | +			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; | 
                                                        |
| 2491 | +			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; | 
                                                        |
| 2492 | 2492 | $out .= '});';  | 
                                                        
| 2493 | 2493 | $out .= '})</script>';  | 
                                                        
| 2494 | 2494 |  			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); | 
                                                        
| 2495 | -			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; | 
                                                        |
| 2495 | +			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; | 
                                                        |
| 2496 | 2496 | $out .= '<br>';  | 
                                                        
| 2497 | 2497 | }  | 
                                                        
| 2498 | 2498 | |
@@ -2551,13 +2551,13 @@ discard block  | 
                                                    ||
| 2551 | 2551 | $resourcestatic->fetch($value['id']);  | 
                                                        
| 2552 | 2552 | $out .= $resourcestatic->getNomUrl(-1);  | 
                                                        
| 2553 | 2553 |  			if ($nbassignetoresource > 1 && $action != 'view') { | 
                                                        
| 2554 | -				$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 . '">'; | 
                                                        |
| 2554 | +				$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.'">'; | 
                                                        |
| 2555 | 2555 | }  | 
                                                        
| 2556 | 2556 | // Show my availability  | 
                                                        
| 2557 | 2557 |  			if ($showproperties) { | 
                                                        
| 2558 | 2558 |  				if (is_array($listofresourceid) && count($listofresourceid)) { | 
                                                        
| 2559 | 2559 | $out .= '<div class="myavailability inline-block">';  | 
                                                        
| 2560 | -					$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>'; | 
                                                        |
| 2560 | +					$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>'; | 
                                                        |
| 2561 | 2561 | $out .= '</div>';  | 
                                                        
| 2562 | 2562 | }  | 
                                                        
| 2563 | 2563 | }  | 
                                                        
@@ -2574,11 +2574,11 @@ discard block  | 
                                                    ||
| 2574 | 2574 | // Method with no ajax  | 
                                                        
| 2575 | 2575 |  		if ($action != 'view') { | 
                                                        
| 2576 | 2576 | $out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">';  | 
                                                        
| 2577 | -			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2577 | +			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2578 | 2578 |  			$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; | 
                                                        
| 2579 | 2579 |  			$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; | 
                                                        
| 2580 | -			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; | 
                                                        |
| 2581 | -			$out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; | 
                                                        |
| 2580 | +			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; | 
                                                        |
| 2581 | +			$out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; | 
                                                        |
| 2582 | 2582 | $out .= '});';  | 
                                                        
| 2583 | 2583 | $out .= '})</script>';  | 
                                                        
| 2584 | 2584 | |
@@ -2586,7 +2586,7 @@ discard block  | 
                                                    ||
| 2586 | 2586 |  			$out .= img_picto('', 'resource', 'class="pictofixedwidth"'); | 
                                                        
| 2587 | 2587 | $out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0);  | 
                                                        
| 2588 | 2588 |  			//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); | 
                                                        
| 2589 | -			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; | 
                                                        |
| 2589 | +			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; | 
                                                        |
| 2590 | 2590 | $out .= '<br>';  | 
                                                        
| 2591 | 2591 | }  | 
                                                        
| 2592 | 2592 | |
@@ -2650,7 +2650,7 @@ discard block  | 
                                                    ||
| 2650 | 2650 | $placeholder = '';  | 
                                                        
| 2651 | 2651 | |
| 2652 | 2652 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 2653 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 2653 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 2654 | 2654 | $producttmpselect = new Product($this->db);  | 
                                                        
| 2655 | 2655 | $producttmpselect->fetch($selected);  | 
                                                        
| 2656 | 2656 | $selected_input_value = $producttmpselect->ref;  | 
                                                        
@@ -2665,20 +2665,20 @@ discard block  | 
                                                    ||
| 2665 | 2665 | }  | 
                                                        
| 2666 | 2666 | }  | 
                                                        
| 2667 | 2667 | // mode=1 means customers products  | 
                                                        
| 2668 | - $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;  | 
                                                        |
| 2669 | -			if ((int) $warehouseId>0) { | 
                                                        |
| 2670 | - $urloption .= '&warehouseid=' . (int) $warehouseId;  | 
                                                        |
| 2668 | + $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;  | 
                                                        |
| 2669 | +			if ((int) $warehouseId > 0) { | 
                                                        |
| 2670 | + $urloption .= '&warehouseid='.(int) $warehouseId;  | 
                                                        |
| 2671 | 2671 | }  | 
                                                        
| 2672 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 2672 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 2673 | 2673 | |
| 2674 | 2674 |  			if (isModEnabled('variants') && is_array($selected_combinations)) { | 
                                                        
| 2675 | 2675 | // Code to automatically insert with javascript the select of attributes under the select of product  | 
                                                        
| 2676 | 2676 | // when a parent of variant has been selected.  | 
                                                        
| 2677 | 2677 | $out .= '  | 
                                                        
| 2678 | 2678 | <!-- script to auto show attributes select tags if a variant was selected -->  | 
                                                        
| 2679 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 2679 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 2680 | 2680 | // auto show attributes fields  | 
                                                        
| 2681 | - selected = ' . json_encode($selected_combinations) . ';  | 
                                                        |
| 2681 | + selected = ' . json_encode($selected_combinations).';  | 
                                                        |
| 2682 | 2682 |  					combvalues = {}; | 
                                                        
| 2683 | 2683 | |
| 2684 | 2684 |  					jQuery(document).ready(function () { | 
                                                        
@@ -2689,7 +2689,7 @@ discard block  | 
                                                    ||
| 2689 | 2689 | }  | 
                                                        
| 2690 | 2690 | });  | 
                                                        
| 2691 | 2691 | |
| 2692 | -						jQuery("input#' . $htmlname . '").change(function () { | 
                                                        |
| 2692 | +						jQuery("input#' . $htmlname.'").change(function () { | 
                                                        |
| 2693 | 2693 | |
| 2694 | 2694 |  							if (!jQuery(this).val()) { | 
                                                        
| 2695 | 2695 | jQuery(\'div#attributes_box\').empty();  | 
                                                        
@@ -2698,7 +2698,7 @@ discard block  | 
                                                    ||
| 2698 | 2698 | |
| 2699 | 2699 |  							console.log("A change has started. We get variants fields to inject html select"); | 
                                                        
| 2700 | 2700 | |
| 2701 | -							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { | 
                                                        |
| 2701 | +							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { | 
                                                        |
| 2702 | 2702 | id: jQuery(this).val()  | 
                                                        
| 2703 | 2703 |  							}, function (data) { | 
                                                        
| 2704 | 2704 | jQuery(\'div#attributes_box\').empty();  | 
                                                        
@@ -2741,21 +2741,21 @@ discard block  | 
                                                    ||
| 2741 | 2741 | })  | 
                                                        
| 2742 | 2742 | });  | 
                                                        
| 2743 | 2743 | |
| 2744 | -						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' | 
                                                        |
| 2744 | +						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' | 
                                                        |
| 2745 | 2745 | });  | 
                                                        
| 2746 | 2746 | </script>  | 
                                                        
| 2747 | 2747 | ';  | 
                                                        
| 2748 | 2748 | }  | 
                                                        
| 2749 | 2749 | |
| 2750 | 2750 |  			if (empty($hidelabel)) { | 
                                                        
| 2751 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 2751 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 2752 | 2752 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 2753 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 2753 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 2754 | 2754 |  				if ($hidelabel == 2) { | 
                                                        
| 2755 | 2755 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 2756 | 2756 | }  | 
                                                        
| 2757 | 2757 | }  | 
                                                        
| 2758 | -			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 2758 | +			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 2759 | 2759 |  			if ($hidelabel == 3) { | 
                                                        
| 2760 | 2760 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 2761 | 2761 | }  | 
                                                        
@@ -2792,33 +2792,33 @@ discard block  | 
                                                    ||
| 2792 | 2792 | // phpcs:enable  | 
                                                        
| 2793 | 2793 | global $db;  | 
                                                        
| 2794 | 2794 | |
| 2795 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 2795 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 2796 | 2796 | |
| 2797 | 2797 | $error = 0;  | 
                                                        
| 2798 | 2798 | $out = '';  | 
                                                        
| 2799 | 2799 | |
| 2800 | 2800 |  		if (!$forcecombo) { | 
                                                        
| 2801 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 2801 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 2802 | 2802 | $events = array();  | 
                                                        
| 2803 | 2803 |  			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); | 
                                                        
| 2804 | 2804 | }  | 
                                                        
| 2805 | 2805 | |
| 2806 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 2806 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 2807 | 2807 | |
| 2808 | 2808 | $sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';  | 
                                                        
| 2809 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';  | 
                                                        |
| 2810 | -		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; | 
                                                        |
| 2809 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';  | 
                                                        |
| 2810 | +		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; | 
                                                        |
| 2811 | 2811 |  		if (!empty($status)) { | 
                                                        
| 2812 | - $sql .= ' AND status = ' . (int) $status;  | 
                                                        |
| 2812 | + $sql .= ' AND status = '.(int) $status;  | 
                                                        |
| 2813 | 2813 | }  | 
                                                        
| 2814 | 2814 |  		if (!empty($type)) { | 
                                                        
| 2815 | - $sql .= ' AND bomtype = ' . (int) $type;  | 
                                                        |
| 2815 | + $sql .= ' AND bomtype = '.(int) $type;  | 
                                                        |
| 2816 | 2816 | }  | 
                                                        
| 2817 | 2817 |  		if (!empty($TProducts)) { | 
                                                        
| 2818 | -			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; | 
                                                        |
| 2818 | +			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; | 
                                                        |
| 2819 | 2819 | }  | 
                                                        
| 2820 | 2820 |  		if (!empty($limit)) { | 
                                                        
| 2821 | - $sql .= ' LIMIT ' . (int) $limit;  | 
                                                        |
| 2821 | + $sql .= ' LIMIT '.(int) $limit;  | 
                                                        |
| 2822 | 2822 | }  | 
                                                        
| 2823 | 2823 | $resql = $db->query($sql);  | 
                                                        
| 2824 | 2824 |  		if ($resql) { | 
                                                        
@@ -2832,11 +2832,11 @@ discard block  | 
                                                    ||
| 2832 | 2832 |  			while ($obj = $db->fetch_object($resql)) { | 
                                                        
| 2833 | 2833 | $product = new Product($db);  | 
                                                        
| 2834 | 2834 | $res = $product->fetch($obj->fk_product);  | 
                                                        
| 2835 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 2835 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 2836 | 2836 |  				if ($obj->rowid == $selected) { | 
                                                        
| 2837 | 2837 | $out .= 'selected';  | 
                                                        
| 2838 | 2838 | }  | 
                                                        
| 2839 | - $out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';  | 
                                                        |
| 2839 | + $out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';  | 
                                                        |
| 2840 | 2840 | }  | 
                                                        
| 2841 | 2841 |  		} else { | 
                                                        
| 2842 | 2842 | $error++;  | 
                                                        
@@ -2894,7 +2894,7 @@ discard block  | 
                                                    ||
| 2894 | 2894 | |
| 2895 | 2895 | $warehouseStatusArray = array();  | 
                                                        
| 2896 | 2896 |  		if (!empty($warehouseStatus)) { | 
                                                        
| 2897 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';  | 
                                                        |
| 2897 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';  | 
                                                        |
| 2898 | 2898 |  			if (preg_match('/warehouseclosed/', $warehouseStatus)) { | 
                                                        
| 2899 | 2899 | $warehouseStatusArray[] = Entrepot::STATUS_CLOSED;  | 
                                                        
| 2900 | 2900 | }  | 
                                                        
@@ -2908,9 +2908,9 @@ discard block  | 
                                                    ||
| 2908 | 2908 | |
| 2909 | 2909 | $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";  | 
                                                        
| 2910 | 2910 |  		if (count($warehouseStatusArray)) { | 
                                                        
| 2911 | -			$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 | 
                                                        |
| 2911 | +			$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 | 
                                                        |
| 2912 | 2912 |  		} else { | 
                                                        
| 2913 | -			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; | 
                                                        |
| 2913 | +			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; | 
                                                        |
| 2914 | 2914 | }  | 
                                                        
| 2915 | 2915 | |
| 2916 | 2916 | $sql = "SELECT ";  | 
                                                        
@@ -2926,9 +2926,9 @@ discard block  | 
                                                    ||
| 2926 | 2926 | |
| 2927 | 2927 |  		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { | 
                                                        
| 2928 | 2928 | //Product category  | 
                                                        
| 2929 | - $sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie  | 
                                                        |
| 2930 | - FROM " . $this->db->prefix() . "categorie_product  | 
                                                        |
| 2931 | - WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid  | 
                                                        |
| 2929 | + $sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie  | 
                                                        |
| 2930 | + FROM " . $this->db->prefix()."categorie_product  | 
                                                        |
| 2931 | + WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid  | 
                                                        |
| 2932 | 2932 | LIMIT 1  | 
                                                        
| 2933 | 2933 | ) AS categorie_product_id ";  | 
                                                        
| 2934 | 2934 | }  | 
                                                        
@@ -2954,15 +2954,15 @@ discard block  | 
                                                    ||
| 2954 | 2954 | }  | 
                                                        
| 2955 | 2955 | // Price by quantity  | 
                                                        
| 2956 | 2956 |  		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
| 2957 | - $sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";  | 
                                                        |
| 2957 | + $sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";  | 
                                                        |
| 2958 | 2958 |  			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
| 2959 | - $sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        |
| 2959 | + $sql .= " AND price_level = ".((int) $price_level);  | 
                                                        |
| 2960 | 2960 | }  | 
                                                        
| 2961 | 2961 | $sql .= " ORDER BY date_price";  | 
                                                        
| 2962 | 2962 | $sql .= " DESC LIMIT 1) as price_rowid";  | 
                                                        
| 2963 | - $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  | 
                                                        |
| 2963 | + $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  | 
                                                        |
| 2964 | 2964 |  			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
| 2965 | - $sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        |
| 2965 | + $sql .= " AND price_level = ".((int) $price_level);  | 
                                                        |
| 2966 | 2966 | }  | 
                                                        
| 2967 | 2967 | $sql .= " ORDER BY date_price";  | 
                                                        
| 2968 | 2968 | $sql .= " DESC LIMIT 1) as price_by_qty";  | 
                                                        
@@ -2972,7 +2972,7 @@ discard block  | 
                                                    ||
| 2972 | 2972 | $sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        
| 2973 | 2973 | |
| 2974 | 2974 |  		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) { | 
                                                        
| 2975 | -			$sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")"; | 
                                                        |
| 2975 | +			$sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")"; | 
                                                        |
| 2976 | 2976 | }  | 
                                                        
| 2977 | 2977 | |
| 2978 | 2978 | // Add from (left join) from hooks  | 
                                                        
@@ -2981,53 +2981,53 @@ discard block  | 
                                                    ||
| 2981 | 2981 | $sql .= $hookmanager->resPrint;  | 
                                                        
| 2982 | 2982 | |
| 2983 | 2983 |  		if (count($warehouseStatusArray)) { | 
                                                        
| 2984 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";  | 
                                                        |
| 2985 | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; | 
                                                        |
| 2986 | -			$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. | 
                                                        |
| 2984 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";  | 
                                                        |
| 2985 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; | 
                                                        |
| 2986 | +			$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. | 
                                                        |
| 2987 | 2987 | }  | 
                                                        
| 2988 | 2988 | |
| 2989 | 2989 | // include search in supplier ref  | 
                                                        
| 2990 | 2990 |  		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { | 
                                                        
| 2991 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 2991 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 2992 | 2992 | }  | 
                                                        
| 2993 | 2993 | |
| 2994 | 2994 | //Price by customer  | 
                                                        
| 2995 | 2995 |  		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { | 
                                                        
| 2996 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";  | 
                                                        |
| 2996 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";  | 
                                                        |
| 2997 | 2997 | }  | 
                                                        
| 2998 | 2998 | // Units  | 
                                                        
| 2999 | 2999 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3000 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 3000 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 3001 | 3001 | }  | 
                                                        
| 3002 | 3002 | // Multilang : we add translation  | 
                                                        
| 3003 | 3003 |  		if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
| 3004 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";  | 
                                                        |
| 3004 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";  | 
                                                        |
| 3005 | 3005 |  			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { | 
                                                        
| 3006 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        |
| 3006 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        |
| 3007 | 3007 | $soc = new Societe($this->db);  | 
                                                        
| 3008 | 3008 | $result = $soc->fetch($socid);  | 
                                                        
| 3009 | 3009 |  				if ($result > 0 && !empty($soc->default_lang)) { | 
                                                        
| 3010 | - $sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";  | 
                                                        |
| 3010 | + $sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";  | 
                                                        |
| 3011 | 3011 |  				} else { | 
                                                        
| 3012 | - $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";  | 
                                                        |
| 3012 | + $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";  | 
                                                        |
| 3013 | 3013 | }  | 
                                                        
| 3014 | 3014 |  			} else { | 
                                                        
| 3015 | - $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";  | 
                                                        |
| 3015 | + $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";  | 
                                                        |
| 3016 | 3016 | }  | 
                                                        
| 3017 | 3017 | }  | 
                                                        
| 3018 | 3018 | |
| 3019 | 3019 |  		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { | 
                                                        
| 3020 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";  | 
                                                        |
| 3020 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";  | 
                                                        |
| 3021 | 3021 | }  | 
                                                        
| 3022 | 3022 | |
| 3023 | -		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; | 
                                                        |
| 3023 | +		$sql .= ' WHERE p.entity IN ('.getEntity('product').')'; | 
                                                        |
| 3024 | 3024 | |
| 3025 | 3025 |  		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { | 
                                                        
| 3026 | 3026 | $sql .= " AND pac.rowid IS NULL";  | 
                                                        
| 3027 | 3027 | }  | 
                                                        
| 3028 | 3028 | |
| 3029 | 3029 |  		if ($finished == 0) { | 
                                                        
| 3030 | - $sql .= " AND p.finished = " . ((int) $finished);  | 
                                                        |
| 3030 | + $sql .= " AND p.finished = ".((int) $finished);  | 
                                                        |
| 3031 | 3031 |  		} elseif ($finished == 1) { | 
                                                        
| 3032 | 3032 | $sql .= " AND p.finished = ".((int) $finished);  | 
                                                        
| 3033 | 3033 | }  | 
                                                        
@@ -3035,11 +3035,11 @@ discard block  | 
                                                    ||
| 3035 | 3035 | $sql .= " AND p.tosell = ".((int) $status);  | 
                                                        
| 3036 | 3036 | }  | 
                                                        
| 3037 | 3037 |  		if ($status_purchase >= 0) { | 
                                                        
| 3038 | - $sql .= " AND p.tobuy = " . ((int) $status_purchase);  | 
                                                        |
| 3038 | + $sql .= " AND p.tobuy = ".((int) $status_purchase);  | 
                                                        |
| 3039 | 3039 | }  | 
                                                        
| 3040 | 3040 | // Filter by product type  | 
                                                        
| 3041 | 3041 |  		if (strval($filtertype) != '') { | 
                                                        
| 3042 | - $sql .= " AND p.fk_product_type = " . ((int) $filtertype);  | 
                                                        |
| 3042 | + $sql .= " AND p.fk_product_type = ".((int) $filtertype);  | 
                                                        |
| 3043 | 3043 |  		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only | 
                                                        
| 3044 | 3044 | $sql .= " AND p.fk_product_type = 1";  | 
                                                        
| 3045 | 3045 |  		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only | 
                                                        
@@ -3047,7 +3047,7 @@ discard block  | 
                                                    ||
| 3047 | 3047 | }  | 
                                                        
| 3048 | 3048 | |
| 3049 | 3049 |  		if ((int) $warehouseId > 0) { | 
                                                        
| 3050 | - $sql .= " AND EXISTS (SELECT psw.fk_product FROM " . $this->db->prefix() . "product_stock as psw WHERE psw.reel>0 AND psw.fk_entrepot=".(int) $warehouseId." AND psw.fk_product = p.rowid)";  | 
                                                        |
| 3050 | + $sql .= " AND EXISTS (SELECT psw.fk_product FROM ".$this->db->prefix()."product_stock as psw WHERE psw.reel>0 AND psw.fk_entrepot=".(int) $warehouseId." AND psw.fk_product = p.rowid)";  | 
                                                        |
| 3051 | 3051 | }  | 
                                                        
| 3052 | 3052 | |
| 3053 | 3053 | // Add where from hooks  | 
                                                        
@@ -3068,21 +3068,21 @@ discard block  | 
                                                    ||
| 3068 | 3068 |  				if ($i > 0) { | 
                                                        
| 3069 | 3069 | $sql .= " AND ";  | 
                                                        
| 3070 | 3070 | }  | 
                                                        
| 3071 | - $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 3071 | + $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 3072 | 3072 |  				if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
| 3073 | - $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 3073 | + $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 3074 | 3074 | }  | 
                                                        
| 3075 | 3075 |  				if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { | 
                                                        
| 3076 | - $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 3076 | + $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 3077 | 3077 | }  | 
                                                        
| 3078 | 3078 |  				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { | 
                                                        
| 3079 | - $sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 3079 | + $sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 3080 | 3080 |  					if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
| 3081 | - $sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 3081 | + $sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 3082 | 3082 | }  | 
                                                        
| 3083 | 3083 | }  | 
                                                        
| 3084 | 3084 |  				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { | 
                                                        
| 3085 | - $sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 3085 | + $sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 3086 | 3086 | }  | 
                                                        
| 3087 | 3087 | $sql .= ")";  | 
                                                        
| 3088 | 3088 | $i++;  | 
                                                        
@@ -3091,12 +3091,12 @@ discard block  | 
                                                    ||
| 3091 | 3091 | $sql .= ")";  | 
                                                        
| 3092 | 3092 | }  | 
                                                        
| 3093 | 3093 |  			if (isModEnabled('barcode')) { | 
                                                        
| 3094 | - $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 3094 | + $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 3095 | 3095 | }  | 
                                                        
| 3096 | 3096 | $sql .= ')';  | 
                                                        
| 3097 | 3097 | }  | 
                                                        
| 3098 | 3098 |  		if (count($warehouseStatusArray)) { | 
                                                        
| 3099 | - $sql .= " GROUP BY " . $selectFields;  | 
                                                        |
| 3099 | + $sql .= " GROUP BY ".$selectFields;  | 
                                                        |
| 3100 | 3100 | }  | 
                                                        
| 3101 | 3101 | |
| 3102 | 3102 | //Sort by category  | 
                                                        
@@ -3111,23 +3111,23 @@ discard block  | 
                                                    ||
| 3111 | 3111 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 3112 | 3112 | |
| 3113 | 3113 | // Build output string  | 
                                                        
| 3114 | - dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);  | 
                                                        |
| 3114 | + dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);  | 
                                                        |
| 3115 | 3115 | $result = $this->db->query($sql);  | 
                                                        
| 3116 | 3116 |  		if ($result) { | 
                                                        
| 3117 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 3118 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3119 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';  | 
                                                        |
| 3117 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 3118 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3119 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';  | 
                                                        |
| 3120 | 3120 | |
| 3121 | 3121 | $num = $this->db->num_rows($result);  | 
                                                        
| 3122 | 3122 | |
| 3123 | 3123 | $events = array();  | 
                                                        
| 3124 | 3124 | |
| 3125 | 3125 |  			if (!$forcecombo) { | 
                                                        
| 3126 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 3126 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 3127 | 3127 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); | 
                                                        
| 3128 | 3128 | }  | 
                                                        
| 3129 | 3129 | |
| 3130 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 3130 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 3131 | 3131 | |
| 3132 | 3132 | $textifempty = '';  | 
                                                        
| 3133 | 3133 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -3144,7 +3144,7 @@ discard block  | 
                                                    ||
| 3144 | 3144 | }  | 
                                                        
| 3145 | 3145 | }  | 
                                                        
| 3146 | 3146 |  			if ($showempty) { | 
                                                        
| 3147 | - $out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>';  | 
                                                        |
| 3147 | + $out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>';  | 
                                                        |
| 3148 | 3148 | }  | 
                                                        
| 3149 | 3149 | |
| 3150 | 3150 | $i = 0;  | 
                                                        
@@ -3155,11 +3155,11 @@ discard block  | 
                                                    ||
| 3155 | 3155 | |
| 3156 | 3156 |  				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 | 
                                                        
| 3157 | 3157 | $sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";  | 
                                                        
| 3158 | - $sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";  | 
                                                        |
| 3159 | - $sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);  | 
                                                        |
| 3158 | + $sql .= " FROM ".$this->db->prefix()."product_price_by_qty";  | 
                                                        |
| 3159 | + $sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);  | 
                                                        |
| 3160 | 3160 | $sql .= " ORDER BY quantity ASC";  | 
                                                        
| 3161 | 3161 | |
| 3162 | - dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);  | 
                                                        |
| 3162 | + dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);  | 
                                                        |
| 3163 | 3163 | $result2 = $this->db->query($sql);  | 
                                                        
| 3164 | 3164 |  					if ($result2) { | 
                                                        
| 3165 | 3165 | $nb_prices = $this->db->num_rows($result2);  | 
                                                        
@@ -3197,7 +3197,7 @@ discard block  | 
                                                    ||
| 3197 | 3197 | $price_product = new Product($this->db);  | 
                                                        
| 3198 | 3198 | $price_product->fetch($objp->rowid, '', '', 1);  | 
                                                        
| 3199 | 3199 | |
| 3200 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3200 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3201 | 3201 | $priceparser = new PriceParser($this->db);  | 
                                                        
| 3202 | 3202 | $price_result = $priceparser->parseProduct($price_product);  | 
                                                        
| 3203 | 3203 |  						if ($price_result >= 0) { | 
                                                        
@@ -3281,7 +3281,7 @@ discard block  | 
                                                    ||
| 3281 | 3281 | $label = $objp->label_translated;  | 
                                                        
| 3282 | 3282 | }  | 
                                                        
| 3283 | 3283 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 3284 | -			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3284 | +			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3285 | 3285 | }  | 
                                                        
| 3286 | 3286 | |
| 3287 | 3287 | $outkey = $objp->rowid;  | 
                                                        
@@ -3302,32 +3302,32 @@ discard block  | 
                                                    ||
| 3302 | 3302 | $outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';  | 
                                                        
| 3303 | 3303 | |
| 3304 | 3304 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
| 3305 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 3305 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 3306 | 3306 | }  | 
                                                        
| 3307 | 3307 | |
| 3308 | 3308 | // Units  | 
                                                        
| 3309 | 3309 | $outvalUnits = '';  | 
                                                        
| 3310 | 3310 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3311 | 3311 |  			if (!empty($objp->unit_short)) { | 
                                                        
| 3312 | - $outvalUnits .= ' - ' . $objp->unit_short;  | 
                                                        |
| 3312 | + $outvalUnits .= ' - '.$objp->unit_short;  | 
                                                        |
| 3313 | 3313 | }  | 
                                                        
| 3314 | 3314 | }  | 
                                                        
| 3315 | 3315 |  		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { | 
                                                        
| 3316 | 3316 |  			if (!empty($objp->weight) && $objp->weight_units !== null) { | 
                                                        
| 3317 | 3317 | $unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);  | 
                                                        
| 3318 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3318 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3319 | 3319 | }  | 
                                                        
| 3320 | 3320 |  			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { | 
                                                        
| 3321 | - $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3322 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3321 | + $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3322 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3323 | 3323 | }  | 
                                                        
| 3324 | 3324 |  			if (!empty($objp->surface) && $objp->surface_units !== null) { | 
                                                        
| 3325 | 3325 | $unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);  | 
                                                        
| 3326 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3326 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3327 | 3327 | }  | 
                                                        
| 3328 | 3328 |  			if (!empty($objp->volume) && $objp->volume_units !== null) { | 
                                                        
| 3329 | 3329 | $unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);  | 
                                                        
| 3330 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3330 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3331 | 3331 | }  | 
                                                        
| 3332 | 3332 | }  | 
                                                        
| 3333 | 3333 |  		if ($outdurationvalue && $outdurationunit) { | 
                                                        
@@ -3339,7 +3339,7 @@ discard block  | 
                                                    ||
| 3339 | 3339 |  				'y' => $langs->trans('Year') | 
                                                        
| 3340 | 3340 | );  | 
                                                        
| 3341 | 3341 |  			if (isset($da[$outdurationunit])) { | 
                                                        
| 3342 | - $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3342 | + $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3343 | 3343 | }  | 
                                                        
| 3344 | 3344 | }  | 
                                                        
| 3345 | 3345 | |
@@ -3359,31 +3359,31 @@ discard block  | 
                                                    ||
| 3359 | 3359 | $labeltoshow = '';  | 
                                                        
| 3360 | 3360 | $labeltoshow .= $objp->ref;  | 
                                                        
| 3361 | 3361 |  		if (!empty($objp->custref)) { | 
                                                        
| 3362 | -			$labeltoshow .= ' (' . $objp->custref . ')'; | 
                                                        |
| 3362 | +			$labeltoshow .= ' ('.$objp->custref.')'; | 
                                                        |
| 3363 | 3363 | }  | 
                                                        
| 3364 | 3364 |  		if ($outbarcode) { | 
                                                        
| 3365 | -			$labeltoshow .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3365 | +			$labeltoshow .= ' ('.$outbarcode.')'; | 
                                                        |
| 3366 | 3366 | }  | 
                                                        
| 3367 | - $labeltoshow .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3367 | + $labeltoshow .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3368 | 3368 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
| 3369 | -			$labeltoshow .= ' (' . getCountry($outorigin, 1) . ')'; | 
                                                        |
| 3369 | +			$labeltoshow .= ' ('.getCountry($outorigin, 1).')'; | 
                                                        |
| 3370 | 3370 | }  | 
                                                        
| 3371 | 3371 | |
| 3372 | 3372 | // Set $labltoshowhtml  | 
                                                        
| 3373 | 3373 | $labeltoshowhtml = '';  | 
                                                        
| 3374 | 3374 | $labeltoshowhtml .= $objp->ref;  | 
                                                        
| 3375 | 3375 |  		if (!empty($objp->custref)) { | 
                                                        
| 3376 | -			$labeltoshowhtml .= ' (' . $objp->custref . ')'; | 
                                                        |
| 3376 | +			$labeltoshowhtml .= ' ('.$objp->custref.')'; | 
                                                        |
| 3377 | 3377 | }  | 
                                                        
| 3378 | 3378 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 3379 | -			$labeltoshowhtml = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); | 
                                                        |
| 3379 | +			$labeltoshowhtml = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $labeltoshowhtml, 1); | 
                                                        |
| 3380 | 3380 | }  | 
                                                        
| 3381 | 3381 |  		if ($outbarcode) { | 
                                                        
| 3382 | -			$labeltoshowhtml .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3382 | +			$labeltoshowhtml .= ' ('.$outbarcode.')'; | 
                                                        |
| 3383 | 3383 | }  | 
                                                        
| 3384 | - $labeltoshowhtml .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3384 | + $labeltoshowhtml .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3385 | 3385 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
| 3386 | -			$labeltoshowhtml .= ' (' . getCountry($outorigin, 1) . ')'; | 
                                                        |
| 3386 | +			$labeltoshowhtml .= ' ('.getCountry($outorigin, 1).')'; | 
                                                        |
| 3387 | 3387 | }  | 
                                                        
| 3388 | 3388 | |
| 3389 | 3389 | // Stock  | 
                                                        
@@ -3391,14 +3391,14 @@ discard block  | 
                                                    ||
| 3391 | 3391 | $labeltoshowhtmlstock = '';  | 
                                                        
| 3392 | 3392 |  		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                        
| 3393 | 3393 |  			if ($user->hasRight('stock', 'lire')) { | 
                                                        
| 3394 | -				$labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3394 | +				$labeltoshowstock .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3395 | 3395 | |
| 3396 | 3396 |  				if ($objp->stock > 0) { | 
                                                        
| 3397 | 3397 | $labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">';  | 
                                                        
| 3398 | 3398 |  				} elseif ($objp->stock <= 0) { | 
                                                        
| 3399 | 3399 | $labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">';  | 
                                                        
| 3400 | 3400 | }  | 
                                                        
| 3401 | -				$labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3401 | +				$labeltoshowhtmlstock .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3402 | 3402 | $labeltoshowhtmlstock .= '</span>';  | 
                                                        
| 3403 | 3403 | |
| 3404 | 3404 |  				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation | 
                                                        
@@ -3409,9 +3409,9 @@ discard block  | 
                                                    ||
| 3409 | 3409 | $tmpproduct->load_virtual_stock();  | 
                                                        
| 3410 | 3410 | $virtualstock = $tmpproduct->stock_theorique;  | 
                                                        
| 3411 | 3411 | |
| 3412 | -					$labeltoshowstock .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; | 
                                                        |
| 3412 | +					$labeltoshowstock .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; | 
                                                        |
| 3413 | 3413 | |
| 3414 | -					$labeltoshowhtmlstock .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; | 
                                                        |
| 3414 | +					$labeltoshowhtmlstock .= ' - '.$langs->transnoentities("VirtualStock").':'; | 
                                                        |
| 3415 | 3415 |  					if ($virtualstock > 0) { | 
                                                        
| 3416 | 3416 | $labeltoshowhtmlstock .= '<span class="product_line_stock_ok">';  | 
                                                        
| 3417 | 3417 |  					} elseif ($virtualstock <= 0) { | 
                                                        
@@ -3432,35 +3432,35 @@ discard block  | 
                                                    ||
| 3432 | 3432 | // If we need a particular price level (from 1 to n)  | 
                                                        
| 3433 | 3433 |  		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { | 
                                                        
| 3434 | 3434 | $sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";  | 
                                                        
| 3435 | - $sql .= " FROM " . $this->db->prefix() . "product_price";  | 
                                                        |
| 3436 | - $sql .= " WHERE fk_product = " . ((int) $objp->rowid);  | 
                                                        |
| 3437 | -			$sql .= " AND entity IN (" . getEntity('productprice') . ")"; | 
                                                        |
| 3438 | - $sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        |
| 3435 | + $sql .= " FROM ".$this->db->prefix()."product_price";  | 
                                                        |
| 3436 | + $sql .= " WHERE fk_product = ".((int) $objp->rowid);  | 
                                                        |
| 3437 | +			$sql .= " AND entity IN (".getEntity('productprice').")"; | 
                                                        |
| 3438 | + $sql .= " AND price_level = ".((int) $price_level);  | 
                                                        |
| 3439 | 3439 | $sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.  | 
                                                        
| 3440 | 3440 | $sql .= " LIMIT 1";  | 
                                                        
| 3441 | 3441 | |
| 3442 | - dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG);  | 
                                                        |
| 3442 | + dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);  | 
                                                        |
| 3443 | 3443 | $result2 = $this->db->query($sql);  | 
                                                        
| 3444 | 3444 |  			if ($result2) { | 
                                                        
| 3445 | 3445 | $objp2 = $this->db->fetch_object($result2);  | 
                                                        
| 3446 | 3446 |  				if ($objp2) { | 
                                                        
| 3447 | 3447 | $found = 1;  | 
                                                        
| 3448 | 3448 |  					if ($objp2->price_base_type == 'HT') { | 
                                                        
| 3449 | -						$labeltoshowprice .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        |
| 3450 | -						$labeltoshowhtmlprice .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        |
| 3449 | +						$labeltoshowprice .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        |
| 3450 | +						$labeltoshowhtmlprice .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        |
| 3451 | 3451 |  					} else { | 
                                                        
| 3452 | -						$labeltoshowprice .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        |
| 3453 | -						$labeltoshowhtmlprice .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        |
| 3452 | +						$labeltoshowprice .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        |
| 3453 | +						$labeltoshowhtmlprice .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        |
| 3454 | 3454 | }  | 
                                                        
| 3455 | 3455 | $outprice_ht = price($objp2->price);  | 
                                                        
| 3456 | 3456 | $outprice_ttc = price($objp2->price_ttc);  | 
                                                        
| 3457 | 3457 | $outpricebasetype = $objp2->price_base_type;  | 
                                                        
| 3458 | 3458 |  					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility | 
                                                        
| 3459 | - $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice  | 
                                                        |
| 3460 | - $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice  | 
                                                        |
| 3459 | + $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice  | 
                                                        |
| 3460 | + $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice  | 
                                                        |
| 3461 | 3461 |  					} else { | 
                                                        
| 3462 | - $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice  | 
                                                        |
| 3463 | - $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice  | 
                                                        |
| 3462 | + $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice  | 
                                                        |
| 3463 | + $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice  | 
                                                        |
| 3464 | 3464 | }  | 
                                                        
| 3465 | 3465 | }  | 
                                                        
| 3466 | 3466 |  			} else { | 
                                                        
@@ -3474,13 +3474,13 @@ discard block  | 
                                                    ||
| 3474 | 3474 | $outqty = $objp->quantity;  | 
                                                        
| 3475 | 3475 | $outdiscount = $objp->remise_percent;  | 
                                                        
| 3476 | 3476 |  			if ($objp->quantity == 1) { | 
                                                        
| 3477 | - $labeltoshowprice .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/";  | 
                                                        |
| 3478 | - $labeltoshowhtmlprice .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/";  | 
                                                        |
| 3477 | + $labeltoshowprice .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/";  | 
                                                        |
| 3478 | + $labeltoshowhtmlprice .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/";  | 
                                                        |
| 3479 | 3479 |  				$labeltoshowprice .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
| 3480 | 3480 |  				$labeltoshowhtmlprice .= $langs->transnoentities("Unit"); | 
                                                        
| 3481 | 3481 |  			} else { | 
                                                        
| 3482 | - $labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;  | 
                                                        |
| 3483 | - $labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;  | 
                                                        |
| 3482 | + $labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;  | 
                                                        |
| 3483 | + $labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;  | 
                                                        |
| 3484 | 3484 |  				$labeltoshowprice .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
| 3485 | 3485 |  				$labeltoshowhtmlprice .= $langs->transnoentities("Units"); | 
                                                        
| 3486 | 3486 | }  | 
                                                        
@@ -3488,16 +3488,16 @@ discard block  | 
                                                    ||
| 3488 | 3488 | $outprice_ht = price($objp->unitprice);  | 
                                                        
| 3489 | 3489 | $outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));  | 
                                                        
| 3490 | 3490 | $outpricebasetype = $objp->price_base_type;  | 
                                                        
| 3491 | - $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  | 
                                                        |
| 3492 | - $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  | 
                                                        |
| 3491 | + $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  | 
                                                        |
| 3492 | + $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  | 
                                                        |
| 3493 | 3493 | }  | 
                                                        
| 3494 | 3494 |  		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { | 
                                                        
| 3495 | -			$labeltoshowprice .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3496 | -			$labeltoshowhtmlprice .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3495 | +			$labeltoshowprice .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3496 | +			$labeltoshowhtmlprice .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3497 | 3497 | }  | 
                                                        
| 3498 | 3498 |  		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { | 
                                                        
| 3499 | -			$labeltoshowprice .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3500 | -			$labeltoshowhtmlprice .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3499 | +			$labeltoshowprice .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3500 | +			$labeltoshowhtmlprice .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3501 | 3501 | }  | 
                                                        
| 3502 | 3502 | |
| 3503 | 3503 | // Price by customer  | 
                                                        
@@ -3506,11 +3506,11 @@ discard block  | 
                                                    ||
| 3506 | 3506 | $found = 1;  | 
                                                        
| 3507 | 3507 | |
| 3508 | 3508 |  				if ($objp->custprice_base_type == 'HT') { | 
                                                        
| 3509 | -					$labeltoshowprice .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        |
| 3510 | -					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        |
| 3509 | +					$labeltoshowprice .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        |
| 3510 | +					$labeltoshowhtmlprice .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        |
| 3511 | 3511 |  				} else { | 
                                                        
| 3512 | -					$labeltoshowprice .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        |
| 3513 | -					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        |
| 3512 | +					$labeltoshowprice .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        |
| 3513 | +					$labeltoshowhtmlprice .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        |
| 3514 | 3514 | }  | 
                                                        
| 3515 | 3515 | |
| 3516 | 3516 | $outprice_ht = price($objp->custprice);  | 
                                                        
@@ -3524,11 +3524,11 @@ discard block  | 
                                                    ||
| 3524 | 3524 | // If level no defined or multiprice not found, we used the default price  | 
                                                        
| 3525 | 3525 |  		if (empty($hidepriceinlabel) && !$found) { | 
                                                        
| 3526 | 3526 |  			if ($objp->price_base_type == 'HT') { | 
                                                        
| 3527 | -				$labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        |
| 3528 | -				$labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        |
| 3527 | +				$labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        |
| 3528 | +				$labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        |
| 3529 | 3529 |  			} else { | 
                                                        
| 3530 | -				$labeltoshowprice .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        |
| 3531 | -				$labeltoshowhtmlprice .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        |
| 3530 | +				$labeltoshowprice .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        |
| 3531 | +				$labeltoshowhtmlprice .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        |
| 3532 | 3532 | }  | 
                                                        
| 3533 | 3533 | $outprice_ht = price($objp->price);  | 
                                                        
| 3534 | 3534 | $outprice_ttc = price($objp->price_ttc);  | 
                                                        
@@ -3539,14 +3539,14 @@ discard block  | 
                                                    ||
| 3539 | 3539 | |
| 3540 | 3540 | |
| 3541 | 3541 | // Build options  | 
                                                        
| 3542 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 3542 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 3543 | 3543 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 3544 | 3544 |  		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { | 
                                                        
| 3545 | - $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 . '"';  | 
                                                        |
| 3545 | + $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.'"';  | 
                                                        |
| 3546 | 3546 | }  | 
                                                        
| 3547 | 3547 |  		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { | 
                                                        
| 3548 | - $opt .= ' data-labeltrans="' . $outlabel_translated . '"';  | 
                                                        |
| 3549 | - $opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';  | 
                                                        |
| 3548 | + $opt .= ' data-labeltrans="'.$outlabel_translated.'"';  | 
                                                        |
| 3549 | + $opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';  | 
                                                        |
| 3550 | 3550 | }  | 
                                                        
| 3551 | 3551 | |
| 3552 | 3552 |  		if ($stocktag == 1) { | 
                                                        
@@ -3641,7 +3641,7 @@ discard block  | 
                                                    ||
| 3641 | 3641 | $selected_input_value = '';  | 
                                                        
| 3642 | 3642 |  		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { | 
                                                        
| 3643 | 3643 |  			if ($selected > 0) { | 
                                                        
| 3644 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 3644 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 3645 | 3645 | $producttmpselect = new Product($this->db);  | 
                                                        
| 3646 | 3646 | $producttmpselect->fetch($selected);  | 
                                                        
| 3647 | 3647 | $selected_input_value = $producttmpselect->ref;  | 
                                                        
@@ -3649,10 +3649,10 @@ discard block  | 
                                                    ||
| 3649 | 3649 | }  | 
                                                        
| 3650 | 3650 | |
| 3651 | 3651 | // mode=2 means suppliers products  | 
                                                        
| 3652 | - $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;  | 
                                                        |
| 3653 | -			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); | 
                                                        |
| 3652 | + $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;  | 
                                                        |
| 3653 | +			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions); | 
                                                        |
| 3654 | 3654 | |
| 3655 | -			print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; | 
                                                        |
| 3655 | +			print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; | 
                                                        |
| 3656 | 3656 |  		} else { | 
                                                        
| 3657 | 3657 | print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);  | 
                                                        
| 3658 | 3658 | }  | 
                                                        
@@ -3712,25 +3712,25 @@ discard block  | 
                                                    ||
| 3712 | 3712 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3713 | 3713 | $sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units";  | 
                                                        
| 3714 | 3714 | }  | 
                                                        
| 3715 | - $sql .= " FROM " . $this->db->prefix() . "product as p";  | 
                                                        |
| 3716 | -		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; | 
                                                        |
| 3715 | + $sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        |
| 3716 | +		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; | 
                                                        |
| 3717 | 3717 |  		if ($socid > 0) { | 
                                                        
| 3718 | - $sql .= " AND pfp.fk_soc = " . ((int) $socid);  | 
                                                        |
| 3718 | + $sql .= " AND pfp.fk_soc = ".((int) $socid);  | 
                                                        |
| 3719 | 3719 | }  | 
                                                        
| 3720 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3720 | + $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3721 | 3721 | // Units  | 
                                                        
| 3722 | 3722 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3723 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 3723 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 3724 | 3724 | }  | 
                                                        
| 3725 | -		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; | 
                                                        |
| 3725 | +		$sql .= " WHERE p.entity IN (".getEntity('product').")"; | 
                                                        |
| 3726 | 3726 |  		if ($statut != -1) { | 
                                                        
| 3727 | - $sql .= " AND p.tobuy = " . ((int) $statut);  | 
                                                        |
| 3727 | + $sql .= " AND p.tobuy = ".((int) $statut);  | 
                                                        |
| 3728 | 3728 | }  | 
                                                        
| 3729 | 3729 |  		if (strval($filtertype) != '') { | 
                                                        
| 3730 | - $sql .= " AND p.fk_product_type = " . ((int) $filtertype);  | 
                                                        |
| 3730 | + $sql .= " AND p.fk_product_type = ".((int) $filtertype);  | 
                                                        |
| 3731 | 3731 | }  | 
                                                        
| 3732 | 3732 |  		if (!empty($filtre)) { | 
                                                        
| 3733 | - $sql .= " " . $filtre;  | 
                                                        |
| 3733 | + $sql .= " ".$filtre;  | 
                                                        |
| 3734 | 3734 | }  | 
                                                        
| 3735 | 3735 | // Add where from hooks  | 
                                                        
| 3736 | 3736 | $parameters = array();  | 
                                                        
@@ -3750,9 +3750,9 @@ discard block  | 
                                                    ||
| 3750 | 3750 |  				if ($i > 0) { | 
                                                        
| 3751 | 3751 | $sql .= " AND ";  | 
                                                        
| 3752 | 3752 | }  | 
                                                        
| 3753 | - $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) . "%'";  | 
                                                        |
| 3753 | + $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)."%'";  | 
                                                        |
| 3754 | 3754 |  				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { | 
                                                        
| 3755 | - $sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 3755 | + $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 3756 | 3756 | }  | 
                                                        
| 3757 | 3757 | $sql .= ")";  | 
                                                        
| 3758 | 3758 | $i++;  | 
                                                        
@@ -3761,8 +3761,8 @@ discard block  | 
                                                    ||
| 3761 | 3761 | $sql .= ")";  | 
                                                        
| 3762 | 3762 | }  | 
                                                        
| 3763 | 3763 |  			if (isModEnabled('barcode')) { | 
                                                        
| 3764 | - $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 3765 | - $sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 3764 | + $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 3765 | + $sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 3766 | 3766 | }  | 
                                                        
| 3767 | 3767 | $sql .= ')';  | 
                                                        
| 3768 | 3768 | }  | 
                                                        
@@ -3771,20 +3771,20 @@ discard block  | 
                                                    ||
| 3771 | 3771 | |
| 3772 | 3772 | // Build output string  | 
                                                        
| 3773 | 3773 | |
| 3774 | - dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);  | 
                                                        |
| 3774 | + dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);  | 
                                                        |
| 3775 | 3775 | $result = $this->db->query($sql);  | 
                                                        
| 3776 | 3776 |  		if ($result) { | 
                                                        
| 3777 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3778 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';  | 
                                                        |
| 3777 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3778 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';  | 
                                                        |
| 3779 | 3779 | |
| 3780 | 3780 | $num = $this->db->num_rows($result);  | 
                                                        
| 3781 | 3781 | |
| 3782 | 3782 | //$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax  | 
                                                        
| 3783 | - $out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 3783 | + $out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 3784 | 3784 |  			if (!$selected) { | 
                                                        
| 3785 | - $out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>';  | 
                                                        |
| 3785 | + $out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>';  | 
                                                        |
| 3786 | 3786 |  			} else { | 
                                                        
| 3787 | - $out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>';  | 
                                                        |
| 3787 | + $out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>';  | 
                                                        |
| 3788 | 3788 | }  | 
                                                        
| 3789 | 3789 | |
| 3790 | 3790 | $i = 0;  | 
                                                        
@@ -3799,7 +3799,7 @@ discard block  | 
                                                    ||
| 3799 | 3799 | |
| 3800 | 3800 | $outkey = $objp->idprodfournprice; // id in table of price  | 
                                                        
| 3801 | 3801 |  				if (!$outkey && $alsoproductwithnosupplierprice) { | 
                                                        
| 3802 | - $outkey = 'idprod_' . $objp->rowid; // id of product  | 
                                                        |
| 3802 | + $outkey = 'idprod_'.$objp->rowid; // id of product  | 
                                                        |
| 3803 | 3803 | }  | 
                                                        
| 3804 | 3804 | |
| 3805 | 3805 | $outref = $objp->ref;  | 
                                                        
@@ -3814,23 +3814,23 @@ discard block  | 
                                                    ||
| 3814 | 3814 | $outvalUnits = '';  | 
                                                        
| 3815 | 3815 |  				if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3816 | 3816 |  					if (!empty($objp->unit_short)) { | 
                                                        
| 3817 | - $outvalUnits .= ' - ' . $objp->unit_short;  | 
                                                        |
| 3817 | + $outvalUnits .= ' - '.$objp->unit_short;  | 
                                                        |
| 3818 | 3818 | }  | 
                                                        
| 3819 | 3819 |  					if (!empty($objp->weight) && $objp->weight_units !== null) { | 
                                                        
| 3820 | 3820 | $unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);  | 
                                                        
| 3821 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3821 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3822 | 3822 | }  | 
                                                        
| 3823 | 3823 |  					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { | 
                                                        
| 3824 | - $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3825 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3824 | + $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3825 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3826 | 3826 | }  | 
                                                        
| 3827 | 3827 |  					if (!empty($objp->surface) && $objp->surface_units !== null) { | 
                                                        
| 3828 | 3828 | $unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);  | 
                                                        
| 3829 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3829 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3830 | 3830 | }  | 
                                                        
| 3831 | 3831 |  					if (!empty($objp->volume) && $objp->volume_units !== null) { | 
                                                        
| 3832 | 3832 | $unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);  | 
                                                        
| 3833 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3833 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3834 | 3834 | }  | 
                                                        
| 3835 | 3835 |  					if ($outdurationvalue && $outdurationunit) { | 
                                                        
| 3836 | 3836 | $da = array(  | 
                                                        
@@ -3841,22 +3841,22 @@ discard block  | 
                                                    ||
| 3841 | 3841 |  							'y' => $langs->trans('Year') | 
                                                        
| 3842 | 3842 | );  | 
                                                        
| 3843 | 3843 |  						if (isset($da[$outdurationunit])) { | 
                                                        
| 3844 | - $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3844 | + $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3845 | 3845 | }  | 
                                                        
| 3846 | 3846 | }  | 
                                                        
| 3847 | 3847 | }  | 
                                                        
| 3848 | 3848 | |
| 3849 | 3849 | $objRef = $objp->ref;  | 
                                                        
| 3850 | 3850 |  				if ($filterkey && $filterkey != '') { | 
                                                        
| 3851 | -					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3851 | +					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3852 | 3852 | }  | 
                                                        
| 3853 | 3853 | $objRefFourn = $objp->ref_fourn;  | 
                                                        
| 3854 | 3854 |  				if ($filterkey && $filterkey != '') { | 
                                                        
| 3855 | -					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); | 
                                                        |
| 3855 | +					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); | 
                                                        |
| 3856 | 3856 | }  | 
                                                        
| 3857 | 3857 | $label = $objp->label;  | 
                                                        
| 3858 | 3858 |  				if ($filterkey && $filterkey != '') { | 
                                                        
| 3859 | -					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3859 | +					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3860 | 3860 | }  | 
                                                        
| 3861 | 3861 | |
| 3862 | 3862 |  				switch ($objp->fk_product_type) { | 
                                                        
@@ -3879,21 +3879,21 @@ discard block  | 
                                                    ||
| 3879 | 3879 | |
| 3880 | 3880 | $optlabel .= $objp->ref;  | 
                                                        
| 3881 | 3881 |  				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { | 
                                                        
| 3882 | -					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; | 
                                                        |
| 3882 | +					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; | 
                                                        |
| 3883 | 3883 | }  | 
                                                        
| 3884 | 3884 |  				if (isModEnabled('barcode') && !empty($objp->barcode)) { | 
                                                        
| 3885 | -					$optlabel .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3885 | +					$optlabel .= ' ('.$outbarcode.')'; | 
                                                        |
| 3886 | 3886 | }  | 
                                                        
| 3887 | - $optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3887 | + $optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3888 | 3888 | |
| 3889 | 3889 | $outvallabel = $objRef;  | 
                                                        
| 3890 | 3890 |  				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { | 
                                                        
| 3891 | -					$outvallabel .= ' (' . $objRefFourn . ')'; | 
                                                        |
| 3891 | +					$outvallabel .= ' ('.$objRefFourn.')'; | 
                                                        |
| 3892 | 3892 | }  | 
                                                        
| 3893 | 3893 |  				if (isModEnabled('barcode') && !empty($objp->barcode)) { | 
                                                        
| 3894 | -					$outvallabel .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3894 | +					$outvallabel .= ' ('.$outbarcode.')'; | 
                                                        |
| 3895 | 3895 | }  | 
                                                        
| 3896 | - $outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3896 | + $outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3897 | 3897 | |
| 3898 | 3898 | // Units  | 
                                                        
| 3899 | 3899 | $optlabel .= $outvalUnits;  | 
                                                        
@@ -3910,7 +3910,7 @@ discard block  | 
                                                    ||
| 3910 | 3910 | $prod_supplier->fourn_tva_tx = $objp->tva_tx;  | 
                                                        
| 3911 | 3911 | $prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;  | 
                                                        
| 3912 | 3912 | |
| 3913 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3913 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3914 | 3914 | $priceparser = new PriceParser($this->db);  | 
                                                        
| 3915 | 3915 | $price_result = $priceparser->parseProductSupplier($prod_supplier);  | 
                                                        
| 3916 | 3916 |  						if ($price_result >= 0) { | 
                                                        
@@ -3921,57 +3921,57 @@ discard block  | 
                                                    ||
| 3921 | 3921 | }  | 
                                                        
| 3922 | 3922 | }  | 
                                                        
| 3923 | 3923 |  					if ($objp->quantity == 1) { | 
                                                        
| 3924 | -						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        |
| 3925 | -						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        |
| 3924 | +						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        |
| 3925 | +						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        |
| 3926 | 3926 |  						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
| 3927 | 3927 |  						$outvallabel .= $langs->transnoentities("Unit"); | 
                                                        
| 3928 | 3928 |  					} else { | 
                                                        
| 3929 | -						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                        |
| 3930 | -						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                        |
| 3931 | -						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3932 | -						$outvallabel .= ' ' . $langs->transnoentities("Units"); | 
                                                        |
| 3929 | +						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                        |
| 3930 | +						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                        |
| 3931 | +						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3932 | +						$outvallabel .= ' '.$langs->transnoentities("Units"); | 
                                                        |
| 3933 | 3933 | }  | 
                                                        
| 3934 | 3934 | |
| 3935 | 3935 |  					if ($objp->quantity > 1) { | 
                                                        
| 3936 | -						$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 | 
                                                        |
| 3937 | -						$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 | 
                                                        |
| 3936 | +						$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 | 
                                                        |
| 3937 | +						$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 | 
                                                        |
| 3938 | 3938 | }  | 
                                                        
| 3939 | 3939 |  					if ($objp->remise_percent >= 1) { | 
                                                        
| 3940 | -						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3941 | -						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3940 | +						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3941 | +						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3942 | 3942 | }  | 
                                                        
| 3943 | 3943 |  					if ($objp->duration) { | 
                                                        
| 3944 | - $optlabel .= " - " . $objp->duration;  | 
                                                        |
| 3945 | - $outvallabel .= " - " . $objp->duration;  | 
                                                        |
| 3944 | + $optlabel .= " - ".$objp->duration;  | 
                                                        |
| 3945 | + $outvallabel .= " - ".$objp->duration;  | 
                                                        |
| 3946 | 3946 | }  | 
                                                        
| 3947 | 3947 |  					if (!$socid) { | 
                                                        
| 3948 | - $optlabel .= " - " . dol_trunc($objp->name, 8);  | 
                                                        |
| 3949 | - $outvallabel .= " - " . dol_trunc($objp->name, 8);  | 
                                                        |
| 3948 | + $optlabel .= " - ".dol_trunc($objp->name, 8);  | 
                                                        |
| 3949 | + $outvallabel .= " - ".dol_trunc($objp->name, 8);  | 
                                                        |
| 3950 | 3950 | }  | 
                                                        
| 3951 | 3951 |  					if ($objp->supplier_reputation) { | 
                                                        
| 3952 | 3952 | //TODO dictionary  | 
                                                        
| 3953 | 3953 |  						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); | 
                                                        
| 3954 | 3954 | |
| 3955 | - $optlabel .= " - " . $reputations[$objp->supplier_reputation];  | 
                                                        |
| 3956 | - $outvallabel .= " - " . $reputations[$objp->supplier_reputation];  | 
                                                        |
| 3955 | + $optlabel .= " - ".$reputations[$objp->supplier_reputation];  | 
                                                        |
| 3956 | + $outvallabel .= " - ".$reputations[$objp->supplier_reputation];  | 
                                                        |
| 3957 | 3957 | }  | 
                                                        
| 3958 | 3958 |  				} else { | 
                                                        
| 3959 | -					$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; | 
                                                        |
| 3960 | -					$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                        |
| 3959 | +					$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; | 
                                                        |
| 3960 | +					$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                        |
| 3961 | 3961 | }  | 
                                                        
| 3962 | 3962 | |
| 3963 | 3963 |  				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                        
| 3964 | 3964 | $novirtualstock = ($showstockinlist == 2);  | 
                                                        
| 3965 | 3965 | |
| 3966 | 3966 |  					if ($user->hasRight('stock', 'lire')) { | 
                                                        
| 3967 | -						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3967 | +						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3968 | 3968 | |
| 3969 | 3969 |  						if ($objp->stock > 0) { | 
                                                        
| 3970 | 3970 | $optlabel .= ' - <span class="product_line_stock_ok">';  | 
                                                        
| 3971 | 3971 |  						} elseif ($objp->stock <= 0) { | 
                                                        
| 3972 | 3972 | $optlabel .= ' - <span class="product_line_stock_too_low">';  | 
                                                        
| 3973 | 3973 | }  | 
                                                        
| 3974 | -						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3974 | +						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3975 | 3975 | $optlabel .= '</span>';  | 
                                                        
| 3976 | 3976 |  						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation | 
                                                        
| 3977 | 3977 |  							$langs->load("stocks"); | 
                                                        
@@ -3981,9 +3981,9 @@ discard block  | 
                                                    ||
| 3981 | 3981 | $tmpproduct->load_virtual_stock();  | 
                                                        
| 3982 | 3982 | $virtualstock = $tmpproduct->stock_theorique;  | 
                                                        
| 3983 | 3983 | |
| 3984 | -							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; | 
                                                        |
| 3984 | +							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; | 
                                                        |
| 3985 | 3985 | |
| 3986 | -							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; | 
                                                        |
| 3986 | +							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; | 
                                                        |
| 3987 | 3987 |  							if ($virtualstock > 0) { | 
                                                        
| 3988 | 3988 | $optlabel .= '<span class="product_line_stock_ok">';  | 
                                                        
| 3989 | 3989 |  							} elseif ($virtualstock <= 0) { | 
                                                        
@@ -3997,7 +3997,7 @@ discard block  | 
                                                    ||
| 3997 | 3997 | }  | 
                                                        
| 3998 | 3998 | }  | 
                                                        
| 3999 | 3999 | |
| 4000 | - $optstart = '<option value="' . $outkey . '"';  | 
                                                        |
| 4000 | + $optstart = '<option value="'.$outkey.'"';  | 
                                                        |
| 4001 | 4001 |  				if ($selected && $selected == $objp->idprodfournprice) { | 
                                                        
| 4002 | 4002 | $optstart .= ' selected';  | 
                                                        
| 4003 | 4003 | }  | 
                                                        
@@ -4006,31 +4006,31 @@ discard block  | 
                                                    ||
| 4006 | 4006 | }  | 
                                                        
| 4007 | 4007 | |
| 4008 | 4008 |  				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { | 
                                                        
| 4009 | - $optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';  | 
                                                        |
| 4010 | - $optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';  | 
                                                        |
| 4011 | - $optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';  | 
                                                        |
| 4012 | - $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';  | 
                                                        |
| 4013 | - $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';  | 
                                                        |
| 4014 | - $optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';  | 
                                                        |
| 4015 | - $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';  | 
                                                        |
| 4016 | - $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';  | 
                                                        |
| 4017 | - $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';  | 
                                                        |
| 4018 | - $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';  | 
                                                        |
| 4009 | + $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';  | 
                                                        |
| 4010 | + $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';  | 
                                                        |
| 4011 | + $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';  | 
                                                        |
| 4012 | + $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';  | 
                                                        |
| 4013 | + $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';  | 
                                                        |
| 4014 | + $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';  | 
                                                        |
| 4015 | + $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';  | 
                                                        |
| 4016 | + $optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';  | 
                                                        |
| 4017 | + $optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';  | 
                                                        |
| 4018 | + $optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"';  | 
                                                        |
| 4019 | 4019 |  					if (isModEnabled('multicurrency')) { | 
                                                        
| 4020 | - $optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"';  | 
                                                        |
| 4021 | - $optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"';  | 
                                                        |
| 4020 | + $optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"';  | 
                                                        |
| 4021 | + $optstart .= ' data-multicurrency-up="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"';  | 
                                                        |
| 4022 | 4022 | }  | 
                                                        
| 4023 | 4023 | }  | 
                                                        
| 4024 | - $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';  | 
                                                        |
| 4024 | + $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';  | 
                                                        |
| 4025 | 4025 | |
| 4026 | 4026 | $outarrayentry = array(  | 
                                                        
| 4027 | 4027 | 'key' => $outkey,  | 
                                                        
| 4028 | 4028 | 'value' => $outref,  | 
                                                        
| 4029 | 4029 | 'label' => $outvallabel,  | 
                                                        
| 4030 | 4030 | 'qty' => $outqty,  | 
                                                        
| 4031 | - 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 4032 | - 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 4033 | - 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 4031 | + 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 4032 | + 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 4033 | + 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 4034 | 4034 | 'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),  | 
                                                        
| 4035 | 4035 | 'tva_tx' => price2num($objp->tva_tx),  | 
                                                        
| 4036 | 4036 | 'default_vat_code' => $objp->default_vat_code,  | 
                                                        
@@ -4060,17 +4060,17 @@ discard block  | 
                                                    ||
| 4060 | 4060 | // Add new entry  | 
                                                        
| 4061 | 4061 | // "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  | 
                                                        
| 4062 | 4062 | // "label" value of json key array is used by jQuery automatically as text for combo box  | 
                                                        
| 4063 | - $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";  | 
                                                        |
| 4063 | + $out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";  | 
                                                        |
| 4064 | 4064 | $outarraypush = array(  | 
                                                        
| 4065 | 4065 | 'key' => $outkey,  | 
                                                        
| 4066 | 4066 | 'value' => $outref,  | 
                                                        
| 4067 | 4067 | 'label' => $outvallabel,  | 
                                                        
| 4068 | 4068 | 'qty' => $outqty,  | 
                                                        
| 4069 | - 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 4069 | + 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 4070 | 4070 | 'price_qty_ht_locale' => price($objp->fprice),  | 
                                                        
| 4071 | - 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 4071 | + 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 4072 | 4072 | 'price_unit_ht_locale' => price($objp->unitprice),  | 
                                                        
| 4073 | - 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 4073 | + 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 4074 | 4074 | 'tva_tx_formated' => price($objp->tva_tx),  | 
                                                        
| 4075 | 4075 | 'tva_tx' => price2num($objp->tva_tx),  | 
                                                        
| 4076 | 4076 | 'default_vat_code' => $objp->default_vat_code,  | 
                                                        
@@ -4103,7 +4103,7 @@ discard block  | 
                                                    ||
| 4103 | 4103 | |
| 4104 | 4104 | $this->db->free($result);  | 
                                                        
| 4105 | 4105 | |
| 4106 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 4106 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 4107 | 4107 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 4108 | 4108 |  		} else { | 
                                                        
| 4109 | 4109 | dol_print_error($this->db);  | 
                                                        
@@ -4135,43 +4135,43 @@ discard block  | 
                                                    ||
| 4135 | 4135 | $sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";  | 
                                                        
| 4136 | 4136 | $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";  | 
                                                        
| 4137 | 4137 | $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";  | 
                                                        
| 4138 | - $sql .= " FROM " . $this->db->prefix() . "product as p";  | 
                                                        |
| 4139 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 4140 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 4141 | -		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; | 
                                                        |
| 4138 | + $sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        |
| 4139 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 4140 | + $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 4141 | +		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; | 
                                                        |
| 4142 | 4142 | $sql .= " AND p.tobuy = 1";  | 
                                                        
| 4143 | 4143 | $sql .= " AND s.fournisseur = 1";  | 
                                                        
| 4144 | - $sql .= " AND p.rowid = " . ((int) $productid);  | 
                                                        |
| 4144 | + $sql .= " AND p.rowid = ".((int) $productid);  | 
                                                        |
| 4145 | 4145 |  		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { | 
                                                        
| 4146 | 4146 | $sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";  | 
                                                        
| 4147 | 4147 |  		} else { | 
                                                        
| 4148 | 4148 | $sql .= " ORDER BY pfp.unitprice ASC";  | 
                                                        
| 4149 | 4149 | }  | 
                                                        
| 4150 | 4150 | |
| 4151 | - dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);  | 
                                                        |
| 4151 | + dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);  | 
                                                        |
| 4152 | 4152 | $result = $this->db->query($sql);  | 
                                                        
| 4153 | 4153 | |
| 4154 | 4154 |  		if ($result) { | 
                                                        
| 4155 | 4155 | $num = $this->db->num_rows($result);  | 
                                                        
| 4156 | 4156 | |
| 4157 | - $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 4157 | + $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 4158 | 4158 | |
| 4159 | 4159 |  			if (!$num) { | 
                                                        
| 4160 | -				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; | 
                                                        |
| 4160 | +				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; | 
                                                        |
| 4161 | 4161 |  			} else { | 
                                                        
| 4162 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 4162 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 4163 | 4163 | $form .= '<option value="0"> </option>';  | 
                                                        
| 4164 | 4164 | |
| 4165 | 4165 | $i = 0;  | 
                                                        
| 4166 | 4166 |  				while ($i < $num) { | 
                                                        
| 4167 | 4167 | $objp = $this->db->fetch_object($result);  | 
                                                        
| 4168 | 4168 | |
| 4169 | - $opt = '<option value="' . $objp->idprodfournprice . '"';  | 
                                                        |
| 4169 | + $opt = '<option value="'.$objp->idprodfournprice.'"';  | 
                                                        |
| 4170 | 4170 | //if there is only one supplier, preselect it  | 
                                                        
| 4171 | 4171 |  					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { | 
                                                        
| 4172 | 4172 | $opt .= ' selected';  | 
                                                        
| 4173 | 4173 | }  | 
                                                        
| 4174 | - $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';  | 
                                                        |
| 4174 | + $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';  | 
                                                        |
| 4175 | 4175 | |
| 4176 | 4176 |  					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { | 
                                                        
| 4177 | 4177 | $prod_supplier = new ProductFournisseur($this->db);  | 
                                                        
@@ -4181,7 +4181,7 @@ discard block  | 
                                                    ||
| 4181 | 4181 | $prod_supplier->fourn_tva_tx = $objp->tva_tx;  | 
                                                        
| 4182 | 4182 | $prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;  | 
                                                        
| 4183 | 4183 | |
| 4184 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 4184 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 4185 | 4185 | $priceparser = new PriceParser($this->db);  | 
                                                        
| 4186 | 4186 | $price_result = $priceparser->parseProductSupplier($prod_supplier);  | 
                                                        
| 4187 | 4187 |  						if ($price_result >= 0) { | 
                                                        
@@ -4192,10 +4192,10 @@ discard block  | 
                                                    ||
| 4192 | 4192 | }  | 
                                                        
| 4193 | 4193 | }  | 
                                                        
| 4194 | 4194 |  					if ($objp->quantity == 1) { | 
                                                        
| 4195 | -						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        |
| 4195 | +						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        |
| 4196 | 4196 | }  | 
                                                        
| 4197 | 4197 | |
| 4198 | - $opt .= $objp->quantity . ' ';  | 
                                                        |
| 4198 | + $opt .= $objp->quantity.' ';  | 
                                                        |
| 4199 | 4199 | |
| 4200 | 4200 |  					if ($objp->quantity == 1) { | 
                                                        
| 4201 | 4201 |  						$opt .= $langs->trans("Unit"); | 
                                                        
@@ -4204,10 +4204,10 @@ discard block  | 
                                                    ||
| 4204 | 4204 | }  | 
                                                        
| 4205 | 4205 |  					if ($objp->quantity > 1) { | 
                                                        
| 4206 | 4206 | $opt .= " - ";  | 
                                                        
| 4207 | -						$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"); | 
                                                        |
| 4207 | +						$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"); | 
                                                        |
| 4208 | 4208 | }  | 
                                                        
| 4209 | 4209 |  					if ($objp->duration) { | 
                                                        
| 4210 | - $opt .= " - " . $objp->duration;  | 
                                                        |
| 4210 | + $opt .= " - ".$objp->duration;  | 
                                                        |
| 4211 | 4211 | }  | 
                                                        
| 4212 | 4212 | $opt .= "</option>\n";  | 
                                                        
| 4213 | 4213 | |
@@ -4245,8 +4245,8 @@ discard block  | 
                                                    ||
| 4245 | 4245 | dol_syslog(__METHOD__, LOG_DEBUG);  | 
                                                        
| 4246 | 4246 | |
| 4247 | 4247 | $sql = "SELECT rowid, code, libelle as label, deposit_percent";  | 
                                                        
| 4248 | - $sql .= " FROM " . $this->db->prefix() . 'c_payment_term';  | 
                                                        |
| 4249 | -		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; | 
                                                        |
| 4248 | + $sql .= " FROM ".$this->db->prefix().'c_payment_term';  | 
                                                        |
| 4249 | +		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; | 
                                                        |
| 4250 | 4250 | $sql .= " AND active > 0";  | 
                                                        
| 4251 | 4251 | $sql .= " ORDER BY sortorder";  | 
                                                        
| 4252 | 4252 | |
@@ -4258,7 +4258,7 @@ discard block  | 
                                                    ||
| 4258 | 4258 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4259 | 4259 | |
| 4260 | 4260 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4261 | -				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4261 | +				$label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4262 | 4262 | $this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 4263 | 4263 | $this->cache_conditions_paiements[$obj->rowid]['label'] = $label;  | 
                                                        
| 4264 | 4264 | $this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;  | 
                                                        
@@ -4286,7 +4286,7 @@ discard block  | 
                                                    ||
| 4286 | 4286 | // phpcs:enable  | 
                                                        
| 4287 | 4287 | global $langs;  | 
                                                        
| 4288 | 4288 | |
| 4289 | - $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability  | 
                                                        |
| 4289 | + $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability  | 
                                                        |
| 4290 | 4290 |  		if ($num > 0) { | 
                                                        
| 4291 | 4291 | return 0; // Cache already loaded  | 
                                                        
| 4292 | 4292 | }  | 
                                                        
@@ -4296,7 +4296,7 @@ discard block  | 
                                                    ||
| 4296 | 4296 |  		$langs->load('propal'); | 
                                                        
| 4297 | 4297 | |
| 4298 | 4298 | $sql = "SELECT rowid, code, label, position";  | 
                                                        
| 4299 | - $sql .= " FROM " . $this->db->prefix() . 'c_availability';  | 
                                                        |
| 4299 | + $sql .= " FROM ".$this->db->prefix().'c_availability';  | 
                                                        |
| 4300 | 4300 | $sql .= " WHERE active > 0";  | 
                                                        
| 4301 | 4301 | |
| 4302 | 4302 | $resql = $this->db->query($sql);  | 
                                                        
@@ -4307,7 +4307,7 @@ discard block  | 
                                                    ||
| 4307 | 4307 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4308 | 4308 | |
| 4309 | 4309 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4310 | -				$label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4310 | +				$label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4311 | 4311 | $this->cache_availability[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 4312 | 4312 | $this->cache_availability[$obj->rowid]['label'] = $label;  | 
                                                        
| 4313 | 4313 | $this->cache_availability[$obj->rowid]['position'] = $obj->position;  | 
                                                        
@@ -4339,17 +4339,17 @@ discard block  | 
                                                    ||
| 4339 | 4339 | |
| 4340 | 4340 | $this->load_cache_availability();  | 
                                                        
| 4341 | 4341 | |
| 4342 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 4342 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 4343 | 4343 | |
| 4344 | - print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4344 | + print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4345 | 4345 |  		if ($addempty) { | 
                                                        
| 4346 | 4346 | print '<option value="0"> </option>';  | 
                                                        
| 4347 | 4347 | }  | 
                                                        
| 4348 | 4348 |  		foreach ($this->cache_availability as $id => $arrayavailability) { | 
                                                        
| 4349 | 4349 |  			if ($selected == $id) { | 
                                                        
| 4350 | - print '<option value="' . $id . '" selected>';  | 
                                                        |
| 4350 | + print '<option value="'.$id.'" selected>';  | 
                                                        |
| 4351 | 4351 |  			} else { | 
                                                        
| 4352 | - print '<option value="' . $id . '">';  | 
                                                        |
| 4352 | + print '<option value="'.$id.'">';  | 
                                                        |
| 4353 | 4353 | }  | 
                                                        
| 4354 | 4354 | print dol_escape_htmltag($arrayavailability['label']);  | 
                                                        
| 4355 | 4355 | print '</option>';  | 
                                                        
@@ -4370,13 +4370,13 @@ discard block  | 
                                                    ||
| 4370 | 4370 |  	{ | 
                                                        
| 4371 | 4371 | global $langs;  | 
                                                        
| 4372 | 4372 | |
| 4373 | - $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason  | 
                                                        |
| 4373 | + $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason  | 
                                                        |
| 4374 | 4374 |  		if ($num > 0) { | 
                                                        
| 4375 | 4375 | return 0; // Cache already loaded  | 
                                                        
| 4376 | 4376 | }  | 
                                                        
| 4377 | 4377 | |
| 4378 | 4378 | $sql = "SELECT rowid, code, label";  | 
                                                        
| 4379 | - $sql .= " FROM " . $this->db->prefix() . 'c_input_reason';  | 
                                                        |
| 4379 | + $sql .= " FROM ".$this->db->prefix().'c_input_reason';  | 
                                                        |
| 4380 | 4380 | $sql .= " WHERE active > 0";  | 
                                                        
| 4381 | 4381 | |
| 4382 | 4382 | $resql = $this->db->query($sql);  | 
                                                        
@@ -4389,8 +4389,8 @@ discard block  | 
                                                    ||
| 4389 | 4389 | |
| 4390 | 4390 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4391 | 4391 | $label = ($obj->label != '-' ? $obj->label : '');  | 
                                                        
| 4392 | -				if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) { | 
                                                        |
| 4393 | -					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work | 
                                                        |
| 4392 | +				if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) { | 
                                                        |
| 4393 | +					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work | 
                                                        |
| 4394 | 4394 | }  | 
                                                        
| 4395 | 4395 |  				if ($langs->trans($obj->code) != $obj->code) { | 
                                                        
| 4396 | 4396 | $label = $langs->trans($obj->code); // So translation key SRC_XXX will work  | 
                                                        
@@ -4430,9 +4430,9 @@ discard block  | 
                                                    ||
| 4430 | 4430 | |
| 4431 | 4431 | $this->loadCacheInputReason();  | 
                                                        
| 4432 | 4432 | |
| 4433 | - print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 4433 | + print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 4434 | 4434 |  		if ($addempty) { | 
                                                        
| 4435 | - print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>';  | 
                                                        |
| 4435 | + print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>';  | 
                                                        |
| 4436 | 4436 | }  | 
                                                        
| 4437 | 4437 |  		foreach ($this->cache_demand_reason as $id => $arraydemandreason) { | 
                                                        
| 4438 | 4438 |  			if ($arraydemandreason['code'] == $exclude) { | 
                                                        
@@ -4440,9 +4440,9 @@ discard block  | 
                                                    ||
| 4440 | 4440 | }  | 
                                                        
| 4441 | 4441 | |
| 4442 | 4442 |  			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { | 
                                                        
| 4443 | - print '<option value="' . $arraydemandreason['id'] . '" selected>';  | 
                                                        |
| 4443 | + print '<option value="'.$arraydemandreason['id'].'" selected>';  | 
                                                        |
| 4444 | 4444 |  			} else { | 
                                                        
| 4445 | - print '<option value="' . $arraydemandreason['id'] . '">';  | 
                                                        |
| 4445 | + print '<option value="'.$arraydemandreason['id'].'">';  | 
                                                        |
| 4446 | 4446 | }  | 
                                                        
| 4447 | 4447 | $label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason  | 
                                                        
| 4448 | 4448 | print $langs->trans($label);  | 
                                                        
@@ -4452,7 +4452,7 @@ discard block  | 
                                                    ||
| 4452 | 4452 |  		if ($user->admin && empty($notooltip)) { | 
                                                        
| 4453 | 4453 |  			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
| 4454 | 4454 | }  | 
                                                        
| 4455 | -		print ajax_combobox('select_' . $htmlname); | 
                                                        |
| 4455 | +		print ajax_combobox('select_'.$htmlname); | 
                                                        |
| 4456 | 4456 | }  | 
                                                        
| 4457 | 4457 | |
| 4458 | 4458 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps  | 
                                                        
@@ -4467,7 +4467,7 @@ discard block  | 
                                                    ||
| 4467 | 4467 | // phpcs:enable  | 
                                                        
| 4468 | 4468 | global $langs;  | 
                                                        
| 4469 | 4469 | |
| 4470 | - $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements  | 
                                                        |
| 4470 | + $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements  | 
                                                        |
| 4471 | 4471 |  		if ($num > 0) { | 
                                                        
| 4472 | 4472 | return $num; // Cache already loaded  | 
                                                        
| 4473 | 4473 | }  | 
                                                        
@@ -4477,8 +4477,8 @@ discard block  | 
                                                    ||
| 4477 | 4477 | $this->cache_types_paiements = array();  | 
                                                        
| 4478 | 4478 | |
| 4479 | 4479 | $sql = "SELECT id, code, libelle as label, type, active";  | 
                                                        
| 4480 | - $sql .= " FROM " . $this->db->prefix() . "c_paiement";  | 
                                                        |
| 4481 | -		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; | 
                                                        |
| 4480 | + $sql .= " FROM ".$this->db->prefix()."c_paiement";  | 
                                                        |
| 4481 | +		$sql .= " WHERE entity IN (".getEntity('c_paiement').")"; | 
                                                        |
| 4482 | 4482 | |
| 4483 | 4483 | $resql = $this->db->query($sql);  | 
                                                        
| 4484 | 4484 |  		if ($resql) { | 
                                                        
@@ -4488,7 +4488,7 @@ discard block  | 
                                                    ||
| 4488 | 4488 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4489 | 4489 | |
| 4490 | 4490 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4491 | -				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4491 | +				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4492 | 4492 | $this->cache_types_paiements[$obj->id]['id'] = $obj->id;  | 
                                                        
| 4493 | 4493 | $this->cache_types_paiements[$obj->id]['code'] = $obj->code;  | 
                                                        
| 4494 | 4494 | $this->cache_types_paiements[$obj->id]['label'] = $label;  | 
                                                        
@@ -4560,17 +4560,17 @@ discard block  | 
                                                    ||
| 4560 | 4560 | global $langs, $user, $conf;  | 
                                                        
| 4561 | 4561 | |
| 4562 | 4562 | $out = '';  | 
                                                        
| 4563 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 4563 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 4564 | 4564 | |
| 4565 | 4565 | $this->load_cache_conditions_paiements();  | 
                                                        
| 4566 | 4566 | |
| 4567 | 4567 | // Set default value if not already set by caller  | 
                                                        
| 4568 | 4568 |  		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { | 
                                                        
| 4569 | - dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);  | 
                                                        |
| 4569 | + dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);  | 
                                                        |
| 4570 | 4570 |  			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); | 
                                                        
| 4571 | 4571 | }  | 
                                                        
| 4572 | 4572 | |
| 4573 | - $out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4573 | + $out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4574 | 4574 |  		if ($addempty) { | 
                                                        
| 4575 | 4575 | $out .= '<option value="0"> </option>';  | 
                                                        
| 4576 | 4576 | }  | 
                                                        
@@ -4584,9 +4584,9 @@ discard block  | 
                                                    ||
| 4584 | 4584 | |
| 4585 | 4585 |  			if ($selected == $id) { | 
                                                        
| 4586 | 4586 | $selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];  | 
                                                        
| 4587 | - $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';  | 
                                                        |
| 4587 | + $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';  | 
                                                        |
| 4588 | 4588 |  			} else { | 
                                                        
| 4589 | - $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';  | 
                                                        |
| 4589 | + $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';  | 
                                                        |
| 4590 | 4590 | }  | 
                                                        
| 4591 | 4591 | $label = $arrayconditions['label'];  | 
                                                        
| 4592 | 4592 | |
@@ -4604,21 +4604,21 @@ discard block  | 
                                                    ||
| 4604 | 4604 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 4605 | 4605 | |
| 4606 | 4606 |  		if ($deposit_percent >= 0) { | 
                                                        
| 4607 | - $out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';  | 
                                                        |
| 4608 | -			$out .= $langs->trans('DepositPercent') . ' : '; | 
                                                        |
| 4609 | - $out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />';  | 
                                                        |
| 4607 | + $out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';  | 
                                                        |
| 4608 | +			$out .= $langs->trans('DepositPercent').' : '; | 
                                                        |
| 4609 | + $out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />';  | 
                                                        |
| 4610 | 4610 | $out .= '</span>';  | 
                                                        
| 4611 | 4611 | $out .= '  | 
                                                        
| 4612 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 4612 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 4613 | 4613 |  					$(document).ready(function () { | 
                                                        
| 4614 | -						$("#' . $htmlname . '").change(function () { | 
                                                        |
| 4614 | +						$("#' . $htmlname.'").change(function () { | 
                                                        |
| 4615 | 4615 |  							let $selected = $(this).find("option:selected"); | 
                                                        
| 4616 | 4616 |  							let depositPercent = $selected.attr("data-deposit_percent"); | 
                                                        
| 4617 | 4617 | |
| 4618 | 4618 |  							if (depositPercent.length > 0) { | 
                                                        
| 4619 | -								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); | 
                                                        |
| 4619 | +								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); | 
                                                        |
| 4620 | 4620 |  							} else { | 
                                                        
| 4621 | -								$("#' . $htmlname . '_deposit_percent_container").hide(); | 
                                                        |
| 4621 | +								$("#' . $htmlname.'_deposit_percent_container").hide(); | 
                                                        |
| 4622 | 4622 | }  | 
                                                        
| 4623 | 4623 | |
| 4624 | 4624 | return true;  | 
                                                        
@@ -4656,7 +4656,7 @@ discard block  | 
                                                    ||
| 4656 | 4656 | |
| 4657 | 4657 | $out = '';  | 
                                                        
| 4658 | 4658 | |
| 4659 | - dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);  | 
                                                        |
| 4659 | + dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);  | 
                                                        |
| 4660 | 4660 | |
| 4661 | 4661 | $filterarray = array();  | 
                                                        
| 4662 | 4662 |  		if ($filtertype == 'CRDT') { | 
                                                        
@@ -4671,11 +4671,11 @@ discard block  | 
                                                    ||
| 4671 | 4671 | |
| 4672 | 4672 | // Set default value if not already set by caller  | 
                                                        
| 4673 | 4673 |  		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { | 
                                                        
| 4674 | - dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);  | 
                                                        |
| 4674 | + dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);  | 
                                                        |
| 4675 | 4675 |  			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); | 
                                                        
| 4676 | 4676 | }  | 
                                                        
| 4677 | 4677 | |
| 4678 | - $out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4678 | + $out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4679 | 4679 |  		if ($empty) { | 
                                                        
| 4680 | 4680 | $out .= '<option value=""> </option>';  | 
                                                        
| 4681 | 4681 | }  | 
                                                        
@@ -4696,13 +4696,13 @@ discard block  | 
                                                    ||
| 4696 | 4696 | }  | 
                                                        
| 4697 | 4697 | |
| 4698 | 4698 |  			if ($format == 0) { | 
                                                        
| 4699 | - $out .= '<option value="' . $id . '"';  | 
                                                        |
| 4699 | + $out .= '<option value="'.$id.'"';  | 
                                                        |
| 4700 | 4700 |  			} elseif ($format == 1) { | 
                                                        
| 4701 | - $out .= '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4701 | + $out .= '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4702 | 4702 |  			} elseif ($format == 2) { | 
                                                        
| 4703 | - $out .= '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4703 | + $out .= '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4704 | 4704 |  			} elseif ($format == 3) { | 
                                                        
| 4705 | - $out .= '<option value="' . $id . '"';  | 
                                                        |
| 4705 | + $out .= '<option value="'.$id.'"';  | 
                                                        |
| 4706 | 4706 | }  | 
                                                        
| 4707 | 4707 | // Print attribute selected or not  | 
                                                        
| 4708 | 4708 |  			if ($format == 1 || $format == 2) { | 
                                                        
@@ -4732,7 +4732,7 @@ discard block  | 
                                                    ||
| 4732 | 4732 |  		if ($user->admin && !$noadmininfo) { | 
                                                        
| 4733 | 4733 |  			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
| 4734 | 4734 | }  | 
                                                        
| 4735 | -		$out .= ajax_combobox('select' . $htmlname); | 
                                                        |
| 4735 | +		$out .= ajax_combobox('select'.$htmlname); | 
                                                        |
| 4736 | 4736 | |
| 4737 | 4737 |  		if (empty($nooutput)) { | 
                                                        
| 4738 | 4738 | print $out;  | 
                                                        
@@ -4754,22 +4754,22 @@ discard block  | 
                                                    ||
| 4754 | 4754 |  	{ | 
                                                        
| 4755 | 4755 | global $langs;  | 
                                                        
| 4756 | 4756 | |
| 4757 | - $return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 4757 | + $return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 4758 | 4758 | $options = array(  | 
                                                        
| 4759 | 4759 |  			'HT' => $langs->trans("HT"), | 
                                                        
| 4760 | 4760 |  			'TTC' => $langs->trans("TTC") | 
                                                        
| 4761 | 4761 | );  | 
                                                        
| 4762 | 4762 |  		foreach ($options as $id => $value) { | 
                                                        
| 4763 | 4763 |  			if ($selected == $id) { | 
                                                        
| 4764 | - $return .= '<option value="' . $id . '" selected>' . $value;  | 
                                                        |
| 4764 | + $return .= '<option value="'.$id.'" selected>'.$value;  | 
                                                        |
| 4765 | 4765 |  			} else { | 
                                                        
| 4766 | - $return .= '<option value="' . $id . '">' . $value;  | 
                                                        |
| 4766 | + $return .= '<option value="'.$id.'">'.$value;  | 
                                                        |
| 4767 | 4767 | }  | 
                                                        
| 4768 | 4768 | $return .= '</option>';  | 
                                                        
| 4769 | 4769 | }  | 
                                                        
| 4770 | 4770 | $return .= '</select>';  | 
                                                        
| 4771 | 4771 |  		if ($addjscombo) { | 
                                                        
| 4772 | -			$return .= ajax_combobox('select_' . $htmlname); | 
                                                        |
| 4772 | +			$return .= ajax_combobox('select_'.$htmlname); | 
                                                        |
| 4773 | 4773 | }  | 
                                                        
| 4774 | 4774 | |
| 4775 | 4775 | return $return;  | 
                                                        
@@ -4787,7 +4787,7 @@ discard block  | 
                                                    ||
| 4787 | 4787 | // phpcs:enable  | 
                                                        
| 4788 | 4788 | global $langs;  | 
                                                        
| 4789 | 4789 | |
| 4790 | - $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode  | 
                                                        |
| 4790 | + $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode  | 
                                                        |
| 4791 | 4791 |  		if ($num > 0) { | 
                                                        
| 4792 | 4792 | return $num; // Cache already loaded  | 
                                                        
| 4793 | 4793 | }  | 
                                                        
@@ -4797,8 +4797,8 @@ discard block  | 
                                                    ||
| 4797 | 4797 | $this->cache_transport_mode = array();  | 
                                                        
| 4798 | 4798 | |
| 4799 | 4799 | $sql = "SELECT rowid, code, label, active";  | 
                                                        
| 4800 | - $sql .= " FROM " . $this->db->prefix() . "c_transport_mode";  | 
                                                        |
| 4801 | -		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; | 
                                                        |
| 4800 | + $sql .= " FROM ".$this->db->prefix()."c_transport_mode";  | 
                                                        |
| 4801 | +		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; | 
                                                        |
| 4802 | 4802 | |
| 4803 | 4803 | $resql = $this->db->query($sql);  | 
                                                        
| 4804 | 4804 |  		if ($resql) { | 
                                                        
@@ -4808,7 +4808,7 @@ discard block  | 
                                                    ||
| 4808 | 4808 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4809 | 4809 | |
| 4810 | 4810 | // If traduction exist, we use it else we take the default label  | 
                                                        
| 4811 | -				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4811 | +				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4812 | 4812 | $this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;  | 
                                                        
| 4813 | 4813 | $this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 4814 | 4814 | $this->cache_transport_mode[$obj->rowid]['label'] = $label;  | 
                                                        
@@ -4842,11 +4842,11 @@ discard block  | 
                                                    ||
| 4842 | 4842 |  	{ | 
                                                        
| 4843 | 4843 | global $langs, $user;  | 
                                                        
| 4844 | 4844 | |
| 4845 | - dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG);  | 
                                                        |
| 4845 | + dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);  | 
                                                        |
| 4846 | 4846 | |
| 4847 | 4847 | $this->load_cache_transport_mode();  | 
                                                        
| 4848 | 4848 | |
| 4849 | - print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4849 | + print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4850 | 4850 |  		if ($empty) { | 
                                                        
| 4851 | 4851 | print '<option value=""> </option>';  | 
                                                        
| 4852 | 4852 | }  | 
                                                        
@@ -4862,13 +4862,13 @@ discard block  | 
                                                    ||
| 4862 | 4862 | }  | 
                                                        
| 4863 | 4863 | |
| 4864 | 4864 |  			if ($format == 0) { | 
                                                        
| 4865 | - print '<option value="' . $id . '"';  | 
                                                        |
| 4865 | + print '<option value="'.$id.'"';  | 
                                                        |
| 4866 | 4866 |  			} elseif ($format == 1) { | 
                                                        
| 4867 | - print '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4867 | + print '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4868 | 4868 |  			} elseif ($format == 2) { | 
                                                        
| 4869 | - print '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4869 | + print '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4870 | 4870 |  			} elseif ($format == 3) { | 
                                                        
| 4871 | - print '<option value="' . $id . '"';  | 
                                                        |
| 4871 | + print '<option value="'.$id.'"';  | 
                                                        |
| 4872 | 4872 | }  | 
                                                        
| 4873 | 4873 | // If text is selected, we compare with code, else with id  | 
                                                        
| 4874 | 4874 |  			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { | 
                                                        
@@ -4916,31 +4916,31 @@ discard block  | 
                                                    ||
| 4916 | 4916 |  		$langs->load("deliveries"); | 
                                                        
| 4917 | 4917 | |
| 4918 | 4918 | $sql = "SELECT rowid, code, libelle as label";  | 
                                                        
| 4919 | - $sql .= " FROM " . $this->db->prefix() . "c_shipment_mode";  | 
                                                        |
| 4919 | + $sql .= " FROM ".$this->db->prefix()."c_shipment_mode";  | 
                                                        |
| 4920 | 4920 | $sql .= " WHERE active > 0";  | 
                                                        
| 4921 | 4921 |  		if ($filtre) { | 
                                                        
| 4922 | - $sql .= " AND " . $filtre;  | 
                                                        |
| 4922 | + $sql .= " AND ".$filtre;  | 
                                                        |
| 4923 | 4923 | }  | 
                                                        
| 4924 | 4924 | $sql .= " ORDER BY libelle ASC";  | 
                                                        
| 4925 | 4925 | |
| 4926 | - dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);  | 
                                                        |
| 4926 | + dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);  | 
                                                        |
| 4927 | 4927 | $result = $this->db->query($sql);  | 
                                                        
| 4928 | 4928 |  		if ($result) { | 
                                                        
| 4929 | 4929 | $num = $this->db->num_rows($result);  | 
                                                        
| 4930 | 4930 | $i = 0;  | 
                                                        
| 4931 | 4931 |  			if ($num) { | 
                                                        
| 4932 | - print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        |
| 4932 | + print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        |
| 4933 | 4933 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 4934 | 4934 | print '<option value="-1"> </option>';  | 
                                                        
| 4935 | 4935 | }  | 
                                                        
| 4936 | 4936 |  				while ($i < $num) { | 
                                                        
| 4937 | 4937 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 4938 | 4938 |  					if ($selected == $obj->rowid) { | 
                                                        
| 4939 | - print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        |
| 4939 | + print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        |
| 4940 | 4940 |  					} else { | 
                                                        
| 4941 | - print '<option value="' . $obj->rowid . '">';  | 
                                                        |
| 4941 | + print '<option value="'.$obj->rowid.'">';  | 
                                                        |
| 4942 | 4942 | }  | 
                                                        
| 4943 | -					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; | 
                                                        |
| 4943 | +					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; | 
                                                        |
| 4944 | 4944 | print '</option>';  | 
                                                        
| 4945 | 4945 | $i++;  | 
                                                        
| 4946 | 4946 | }  | 
                                                        
@@ -4949,7 +4949,7 @@ discard block  | 
                                                    ||
| 4949 | 4949 |  					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
| 4950 | 4950 | }  | 
                                                        
| 4951 | 4951 | |
| 4952 | -				print ajax_combobox('select' . $htmlname); | 
                                                        |
| 4952 | +				print ajax_combobox('select'.$htmlname); | 
                                                        |
| 4953 | 4953 |  			} else { | 
                                                        
| 4954 | 4954 |  				print $langs->trans("NoShippingMethodDefined"); | 
                                                        
| 4955 | 4955 | }  | 
                                                        
@@ -4974,16 +4974,16 @@ discard block  | 
                                                    ||
| 4974 | 4974 |  		$langs->load("deliveries"); | 
                                                        
| 4975 | 4975 | |
| 4976 | 4976 |  		if ($htmlname != "none") { | 
                                                        
| 4977 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 4977 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 4978 | 4978 | print '<input type="hidden" name="action" value="setshippingmethod">';  | 
                                                        
| 4979 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 4979 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 4980 | 4980 | $this->selectShippingMethod($selected, $htmlname, '', $addempty);  | 
                                                        
| 4981 | -			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 4981 | +			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 4982 | 4982 | print '</form>';  | 
                                                        
| 4983 | 4983 |  		} else { | 
                                                        
| 4984 | 4984 |  			if ($selected) { | 
                                                        
| 4985 | 4985 | $code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');  | 
                                                        
| 4986 | -				print $langs->trans("SendingMethod" . strtoupper($code)); | 
                                                        |
| 4986 | +				print $langs->trans("SendingMethod".strtoupper($code)); | 
                                                        |
| 4987 | 4987 |  			} else { | 
                                                        
| 4988 | 4988 | print " ";  | 
                                                        
| 4989 | 4989 | }  | 
                                                        
@@ -5006,10 +5006,10 @@ discard block  | 
                                                    ||
| 5006 | 5006 | |
| 5007 | 5007 | $opt = '<option value="" selected></option>';  | 
                                                        
| 5008 | 5008 | $sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";  | 
                                                        
| 5009 | - $sql .= ' FROM ' . $this->db->prefix() . 'facture';  | 
                                                        |
| 5010 | -		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; | 
                                                        |
| 5009 | + $sql .= ' FROM '.$this->db->prefix().'facture';  | 
                                                        |
| 5010 | +		$sql .= ' WHERE entity IN ('.getEntity('invoice').')'; | 
                                                        |
| 5011 | 5011 | $sql .= ' AND situation_counter >= 1';  | 
                                                        
| 5012 | - $sql .= ' AND fk_soc = ' . (int) $socid;  | 
                                                        |
| 5012 | + $sql .= ' AND fk_soc = '.(int) $socid;  | 
                                                        |
| 5013 | 5013 | $sql .= ' AND type <> 2';  | 
                                                        
| 5014 | 5014 | $sql .= ' ORDER by situation_cycle_ref, situation_counter desc';  | 
                                                        
| 5015 | 5015 | $resql = $this->db->query($sql);  | 
                                                        
@@ -5027,19 +5027,19 @@ discard block  | 
                                                    ||
| 5027 | 5027 | //Not prov?  | 
                                                        
| 5028 | 5028 |  						if (substr($obj->ref, 1, 4) != 'PROV') { | 
                                                        
| 5029 | 5029 |  							if ($selected == $obj->rowid) { | 
                                                        
| 5030 | - $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';  | 
                                                        |
| 5030 | + $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';  | 
                                                        |
| 5031 | 5031 |  							} else { | 
                                                        
| 5032 | - $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';  | 
                                                        |
| 5032 | + $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';  | 
                                                        |
| 5033 | 5033 | }  | 
                                                        
| 5034 | 5034 | }  | 
                                                        
| 5035 | 5035 | }  | 
                                                        
| 5036 | 5036 | }  | 
                                                        
| 5037 | 5037 | }  | 
                                                        
| 5038 | 5038 |  		} else { | 
                                                        
| 5039 | -			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); | 
                                                        |
| 5039 | +			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); | 
                                                        |
| 5040 | 5040 | }  | 
                                                        
| 5041 | 5041 |  		if ($opt == '<option value ="" selected></option>') { | 
                                                        
| 5042 | -			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; | 
                                                        |
| 5042 | +			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; | 
                                                        |
| 5043 | 5043 | }  | 
                                                        
| 5044 | 5044 | return $opt;  | 
                                                        
| 5045 | 5045 | }  | 
                                                        
@@ -5059,12 +5059,12 @@ discard block  | 
                                                    ||
| 5059 | 5059 | |
| 5060 | 5060 |  		$langs->load('products'); | 
                                                        
| 5061 | 5061 | |
| 5062 | - $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 5062 | + $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 5063 | 5063 | |
| 5064 | - $sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units";  | 
                                                        |
| 5064 | + $sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";  | 
                                                        |
| 5065 | 5065 | $sql .= ' WHERE active > 0';  | 
                                                        
| 5066 | 5066 |  		if (!empty($unit_type)) { | 
                                                        
| 5067 | - $sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'";  | 
                                                        |
| 5067 | + $sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";  | 
                                                        |
| 5068 | 5068 | }  | 
                                                        
| 5069 | 5069 | $sql .= " ORDER BY sortorder";  | 
                                                        
| 5070 | 5070 | |
@@ -5076,14 +5076,14 @@ discard block  | 
                                                    ||
| 5076 | 5076 | |
| 5077 | 5077 |  			while ($res = $this->db->fetch_object($resql)) { | 
                                                        
| 5078 | 5078 | $unitLabel = $res->label;  | 
                                                        
| 5079 | -				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before | 
                                                        |
| 5080 | -					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; | 
                                                        |
| 5079 | +				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before | 
                                                        |
| 5080 | +					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; | 
                                                        |
| 5081 | 5081 | }  | 
                                                        
| 5082 | 5082 | |
| 5083 | 5083 |  				if ($selected == $res->rowid) { | 
                                                        
| 5084 | - $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';  | 
                                                        |
| 5084 | + $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';  | 
                                                        |
| 5085 | 5085 |  				} else { | 
                                                        
| 5086 | - $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';  | 
                                                        |
| 5086 | + $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';  | 
                                                        |
| 5087 | 5087 | }  | 
                                                        
| 5088 | 5088 | }  | 
                                                        
| 5089 | 5089 | $return .= '</select>';  | 
                                                        
@@ -5118,23 +5118,23 @@ discard block  | 
                                                    ||
| 5118 | 5118 | $num = 0;  | 
                                                        
| 5119 | 5119 | |
| 5120 | 5120 | $sql = "SELECT rowid, label, bank, clos as status, currency_code";  | 
                                                        
| 5121 | - $sql .= " FROM " . $this->db->prefix() . "bank_account";  | 
                                                        |
| 5122 | -		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; | 
                                                        |
| 5121 | + $sql .= " FROM ".$this->db->prefix()."bank_account";  | 
                                                        |
| 5122 | +		$sql .= " WHERE entity IN (".getEntity('bank_account').")"; | 
                                                        |
| 5123 | 5123 |  		if ($status != 2) { | 
                                                        
| 5124 | - $sql .= " AND clos = " . (int) $status;  | 
                                                        |
| 5124 | + $sql .= " AND clos = ".(int) $status;  | 
                                                        |
| 5125 | 5125 | }  | 
                                                        
| 5126 | 5126 |  		if ($filtre) {	// TODO Support USF | 
                                                        
| 5127 | - $sql .= " AND " . $filtre;  | 
                                                        |
| 5127 | + $sql .= " AND ".$filtre;  | 
                                                        |
| 5128 | 5128 | }  | 
                                                        
| 5129 | 5129 | $sql .= " ORDER BY label";  | 
                                                        
| 5130 | 5130 | |
| 5131 | - dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);  | 
                                                        |
| 5131 | + dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);  | 
                                                        |
| 5132 | 5132 | $result = $this->db->query($sql);  | 
                                                        
| 5133 | 5133 |  		if ($result) { | 
                                                        
| 5134 | 5134 | $num = $this->db->num_rows($result);  | 
                                                        
| 5135 | 5135 | $i = 0;  | 
                                                        
| 5136 | 5136 |  			if ($num) { | 
                                                        
| 5137 | - $out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        |
| 5137 | + $out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        |
| 5138 | 5138 | |
| 5139 | 5139 |  				if (!empty($useempty) && !is_numeric($useempty)) { | 
                                                        
| 5140 | 5140 | $out .= '<option value="-1">'.$langs->trans($useempty).'</option>';  | 
                                                        
@@ -5145,27 +5145,27 @@ discard block  | 
                                                    ||
| 5145 | 5145 |  				while ($i < $num) { | 
                                                        
| 5146 | 5146 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 5147 | 5147 |  					if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { | 
                                                        
| 5148 | - $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>';  | 
                                                        |
| 5148 | + $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>';  | 
                                                        |
| 5149 | 5149 |  					} else { | 
                                                        
| 5150 | - $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">';  | 
                                                        |
| 5150 | + $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">';  | 
                                                        |
| 5151 | 5151 | }  | 
                                                        
| 5152 | 5152 | $out .= trim($obj->label);  | 
                                                        
| 5153 | 5153 |  					if ($showcurrency) { | 
                                                        
| 5154 | -						$out .= ' (' . $obj->currency_code . ')'; | 
                                                        |
| 5154 | +						$out .= ' ('.$obj->currency_code.')'; | 
                                                        |
| 5155 | 5155 | }  | 
                                                        
| 5156 | 5156 |  					if ($status == 2 && $obj->status == 1) { | 
                                                        
| 5157 | -						$out .= ' (' . $langs->trans("Closed") . ')'; | 
                                                        |
| 5157 | +						$out .= ' ('.$langs->trans("Closed").')'; | 
                                                        |
| 5158 | 5158 | }  | 
                                                        
| 5159 | 5159 | $out .= '</option>';  | 
                                                        
| 5160 | 5160 | $i++;  | 
                                                        
| 5161 | 5161 | }  | 
                                                        
| 5162 | 5162 | $out .= "</select>";  | 
                                                        
| 5163 | -				$out .= ajax_combobox('select' . $htmlname); | 
                                                        |
| 5163 | +				$out .= ajax_combobox('select'.$htmlname); | 
                                                        |
| 5164 | 5164 |  			} else { | 
                                                        
| 5165 | 5165 |  				if ($status == 0) { | 
                                                        
| 5166 | -					$out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; | 
                                                        |
| 5166 | +					$out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; | 
                                                        |
| 5167 | 5167 |  				} else { | 
                                                        
| 5168 | -					$out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; | 
                                                        |
| 5168 | +					$out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>'; | 
                                                        |
| 5169 | 5169 | }  | 
                                                        
| 5170 | 5170 | }  | 
                                                        
| 5171 | 5171 |  		} else { | 
                                                        
@@ -5201,23 +5201,23 @@ discard block  | 
                                                    ||
| 5201 | 5201 | $num = 0;  | 
                                                        
| 5202 | 5202 | |
| 5203 | 5203 | $sql = "SELECT rowid, name, fk_country, status, entity";  | 
                                                        
| 5204 | - $sql .= " FROM " . $this->db->prefix() . "establishment";  | 
                                                        |
| 5204 | + $sql .= " FROM ".$this->db->prefix()."establishment";  | 
                                                        |
| 5205 | 5205 | $sql .= " WHERE 1=1";  | 
                                                        
| 5206 | 5206 |  		if ($status != 2) { | 
                                                        
| 5207 | - $sql .= " AND status = " . (int) $status;  | 
                                                        |
| 5207 | + $sql .= " AND status = ".(int) $status;  | 
                                                        |
| 5208 | 5208 | }  | 
                                                        
| 5209 | 5209 |  		if ($filtre) {	// TODO Support USF | 
                                                        
| 5210 | - $sql .= " AND " . $filtre;  | 
                                                        |
| 5210 | + $sql .= " AND ".$filtre;  | 
                                                        |
| 5211 | 5211 | }  | 
                                                        
| 5212 | 5212 | $sql .= " ORDER BY name";  | 
                                                        
| 5213 | 5213 | |
| 5214 | - dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG);  | 
                                                        |
| 5214 | + dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);  | 
                                                        |
| 5215 | 5215 | $result = $this->db->query($sql);  | 
                                                        
| 5216 | 5216 |  		if ($result) { | 
                                                        
| 5217 | 5217 | $num = $this->db->num_rows($result);  | 
                                                        
| 5218 | 5218 | $i = 0;  | 
                                                        
| 5219 | 5219 |  			if ($num) { | 
                                                        
| 5220 | - print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        |
| 5220 | + print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        |
| 5221 | 5221 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 5222 | 5222 | print '<option value="-1"> </option>';  | 
                                                        
| 5223 | 5223 | }  | 
                                                        
@@ -5225,13 +5225,13 @@ discard block  | 
                                                    ||
| 5225 | 5225 |  				while ($i < $num) { | 
                                                        
| 5226 | 5226 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 5227 | 5227 |  					if ($selected == $obj->rowid) { | 
                                                        
| 5228 | - print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        |
| 5228 | + print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        |
| 5229 | 5229 |  					} else { | 
                                                        
| 5230 | - print '<option value="' . $obj->rowid . '">';  | 
                                                        |
| 5230 | + print '<option value="'.$obj->rowid.'">';  | 
                                                        |
| 5231 | 5231 | }  | 
                                                        
| 5232 | 5232 | print trim($obj->name);  | 
                                                        
| 5233 | 5233 |  					if ($status == 2 && $obj->status == 1) { | 
                                                        
| 5234 | -						print ' (' . $langs->trans("Closed") . ')'; | 
                                                        |
| 5234 | +						print ' ('.$langs->trans("Closed").')'; | 
                                                        |
| 5235 | 5235 | }  | 
                                                        
| 5236 | 5236 | print '</option>';  | 
                                                        
| 5237 | 5237 | $i++;  | 
                                                        
@@ -5239,9 +5239,9 @@ discard block  | 
                                                    ||
| 5239 | 5239 | print "</select>";  | 
                                                        
| 5240 | 5240 |  			} else { | 
                                                        
| 5241 | 5241 |  				if ($status == 0) { | 
                                                        
| 5242 | -					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; | 
                                                        |
| 5242 | +					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; | 
                                                        |
| 5243 | 5243 |  				} else { | 
                                                        
| 5244 | -					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; | 
                                                        |
| 5244 | +					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; | 
                                                        |
| 5245 | 5245 | }  | 
                                                        
| 5246 | 5246 | }  | 
                                                        
| 5247 | 5247 | |
@@ -5265,20 +5265,20 @@ discard block  | 
                                                    ||
| 5265 | 5265 |  	{ | 
                                                        
| 5266 | 5266 | global $langs;  | 
                                                        
| 5267 | 5267 |  		if ($htmlname != "none") { | 
                                                        
| 5268 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5268 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5269 | 5269 | print '<input type="hidden" name="action" value="setbankaccount">';  | 
                                                        
| 5270 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5270 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5271 | 5271 |  			print img_picto('', 'bank_account', 'class="pictofixedwidth"'); | 
                                                        
| 5272 | 5272 | $nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);  | 
                                                        
| 5273 | 5273 |  			if ($nbaccountfound > 0) { | 
                                                        
| 5274 | -				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5274 | +				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5275 | 5275 | }  | 
                                                        
| 5276 | 5276 | print '</form>';  | 
                                                        
| 5277 | 5277 |  		} else { | 
                                                        
| 5278 | 5278 |  			$langs->load('banks'); | 
                                                        
| 5279 | 5279 | |
| 5280 | 5280 |  			if ($selected) { | 
                                                        
| 5281 | - require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';  | 
                                                        |
| 5281 | + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';  | 
                                                        |
| 5282 | 5282 | $bankstatic = new Account($this->db);  | 
                                                        
| 5283 | 5283 | $result = $bankstatic->fetch($selected);  | 
                                                        
| 5284 | 5284 |  				if ($result) { | 
                                                        
@@ -5317,19 +5317,19 @@ discard block  | 
                                                    ||
| 5317 | 5317 | global $conf, $langs;  | 
                                                        
| 5318 | 5318 |  		$langs->load("categories"); | 
                                                        
| 5319 | 5319 | |
| 5320 | - include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';  | 
                                                        |
| 5320 | + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';  | 
                                                        |
| 5321 | 5321 | |
| 5322 | 5322 | // For backward compatibility  | 
                                                        
| 5323 | 5323 |  		if (is_numeric($type)) { | 
                                                        
| 5324 | - dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);  | 
                                                        |
| 5324 | + dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);  | 
                                                        |
| 5325 | 5325 | }  | 
                                                        
| 5326 | 5326 | |
| 5327 | 5327 |  		if ($type === Categorie::TYPE_BANK_LINE) { | 
                                                        
| 5328 | 5328 | // TODO Move this into common category feature  | 
                                                        
| 5329 | 5329 | $cate_arbo = array();  | 
                                                        
| 5330 | 5330 | $sql = "SELECT c.label, c.rowid";  | 
                                                        
| 5331 | - $sql .= " FROM " . $this->db->prefix() . "category_bank as c";  | 
                                                        |
| 5332 | - $sql .= " WHERE entity = " . $conf->entity;  | 
                                                        |
| 5331 | + $sql .= " FROM ".$this->db->prefix()."category_bank as c";  | 
                                                        |
| 5332 | + $sql .= " WHERE entity = ".$conf->entity;  | 
                                                        |
| 5333 | 5333 | $sql .= " ORDER BY c.label";  | 
                                                        
| 5334 | 5334 | $result = $this->db->query($sql);  | 
                                                        
| 5335 | 5335 |  			if ($result) { | 
                                                        
@@ -5355,12 +5355,12 @@ discard block  | 
                                                    ||
| 5355 | 5355 | $outarrayrichhtml = array();  | 
                                                        
| 5356 | 5356 | |
| 5357 | 5357 | |
| 5358 | - $output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 5358 | + $output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 5359 | 5359 |  		if (is_array($cate_arbo)) { | 
                                                        
| 5360 | 5360 | $num = count($cate_arbo);  | 
                                                        
| 5361 | 5361 | |
| 5362 | 5362 |  			if (!$num) { | 
                                                        
| 5363 | -				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; | 
                                                        |
| 5363 | +				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; | 
                                                        |
| 5364 | 5364 |  			} else { | 
                                                        
| 5365 | 5365 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 5366 | 5366 | $output .= '<option value="-1"> </option>';  | 
                                                        
@@ -5372,15 +5372,15 @@ discard block  | 
                                                    ||
| 5372 | 5372 | $add = '';  | 
                                                        
| 5373 | 5373 | }  | 
                                                        
| 5374 | 5374 | |
| 5375 | -					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); | 
                                                        |
| 5375 | +					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); | 
                                                        |
| 5376 | 5376 | $labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');  | 
                                                        
| 5377 | 5377 | |
| 5378 | 5378 | $outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];  | 
                                                        
| 5379 | 5379 | |
| 5380 | 5380 | $outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow;  | 
                                                        
| 5381 | 5381 | |
| 5382 | - $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"';  | 
                                                        |
| 5383 | - $output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"';  | 
                                                        |
| 5382 | + $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';  | 
                                                        |
| 5383 | + $output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"';  | 
                                                        |
| 5384 | 5384 | $output .= '>';  | 
                                                        
| 5385 | 5385 | $output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');  | 
                                                        
| 5386 | 5386 | $output .= '</option>';  | 
                                                        
@@ -5424,7 +5424,7 @@ discard block  | 
                                                    ||
| 5424 | 5424 | public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)  | 
                                                        
| 5425 | 5425 |  	{ | 
                                                        
| 5426 | 5426 | // phpcs:enable  | 
                                                        
| 5427 | - dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);  | 
                                                        |
| 5427 | + dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);  | 
                                                        |
| 5428 | 5428 | print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);  | 
                                                        
| 5429 | 5429 | }  | 
                                                        
| 5430 | 5430 | |
@@ -5459,7 +5459,7 @@ discard block  | 
                                                    ||
| 5459 | 5459 |  	{ | 
                                                        
| 5460 | 5460 | global $langs, $conf;  | 
                                                        
| 5461 | 5461 | |
| 5462 | - $more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->';  | 
                                                        |
| 5462 | + $more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->';  | 
                                                        |
| 5463 | 5463 | $formconfirm = '';  | 
                                                        
| 5464 | 5464 | $inputok = array();  | 
                                                        
| 5465 | 5465 | $inputko = array();  | 
                                                        
@@ -5483,27 +5483,27 @@ discard block  | 
                                                    ||
| 5483 | 5483 |  			foreach ($formquestion as $key => $input) { | 
                                                        
| 5484 | 5484 |  				if (is_array($input) && !empty($input)) { | 
                                                        
| 5485 | 5485 |  					if ($input['type'] == 'hidden') { | 
                                                        
| 5486 | - $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');  | 
                                                        |
| 5487 | - $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');  | 
                                                        |
| 5486 | + $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');  | 
                                                        |
| 5487 | + $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');  | 
                                                        |
| 5488 | 5488 | |
| 5489 | - $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";  | 
                                                        |
| 5489 | + $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";  | 
                                                        |
| 5490 | 5490 | }  | 
                                                        
| 5491 | 5491 | }  | 
                                                        
| 5492 | 5492 | }  | 
                                                        
| 5493 | 5493 | |
| 5494 | 5494 | // Now add questions  | 
                                                        
| 5495 | 5495 | $moreonecolumn = '';  | 
                                                        
| 5496 | - $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n";  | 
                                                        |
| 5496 | + $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";  | 
                                                        |
| 5497 | 5497 |  			foreach ($formquestion as $key => $input) { | 
                                                        
| 5498 | 5498 |  				if (is_array($input) && !empty($input)) { | 
                                                        
| 5499 | - $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); // deprecated. Use morecss instead.  | 
                                                        |
| 5500 | - $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');  | 
                                                        |
| 5501 | - $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');  | 
                                                        |
| 5499 | + $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.  | 
                                                        |
| 5500 | + $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');  | 
                                                        |
| 5501 | + $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');  | 
                                                        |
| 5502 | 5502 | |
| 5503 | 5503 |  					if ($input['type'] == 'text') { | 
                                                        
| 5504 | -						$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"; | 
                                                        |
| 5504 | +						$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"; | 
                                                        |
| 5505 | 5505 |  					} elseif ($input['type'] == 'password') { | 
                                                        
| 5506 | -						$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"; | 
                                                        |
| 5506 | +						$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"; | 
                                                        |
| 5507 | 5507 |  					} elseif ($input['type'] == 'textarea') { | 
                                                        
| 5508 | 5508 |  						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; | 
                                                        
| 5509 | 5509 | $more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';  | 
                                                        
@@ -5511,8 +5511,8 @@ discard block  | 
                                                    ||
| 5511 | 5511 | $more .= '</textarea>';  | 
                                                        
| 5512 | 5512 | $more .= '</div></div>'."\n";*/  | 
                                                        
| 5513 | 5513 | $moreonecolumn .= '<div class="margintoponly">';  | 
                                                        
| 5514 | - $moreonecolumn .= $input['label'] . '<br>';  | 
                                                        |
| 5515 | - $moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>';  | 
                                                        |
| 5514 | + $moreonecolumn .= $input['label'].'<br>';  | 
                                                        |
| 5515 | + $moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';  | 
                                                        |
| 5516 | 5516 | $moreonecolumn .= $input['value'];  | 
                                                        
| 5517 | 5517 | $moreonecolumn .= '</textarea>';  | 
                                                        
| 5518 | 5518 | $moreonecolumn .= '</div>';  | 
                                                        
@@ -5529,20 +5529,20 @@ discard block  | 
                                                    ||
| 5529 | 5529 | $disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;  | 
                                                        
| 5530 | 5530 | $sort = isset($input['select_sort']) ? $input['select_sort'] : '';  | 
                                                        
| 5531 | 5531 | |
| 5532 | -						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; | 
                                                        |
| 5532 | +						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; | 
                                                        |
| 5533 | 5533 |  						if (!empty($input['label'])) { | 
                                                        
| 5534 | - $more .= $input['label'] . '</div><div class="tagtd left">';  | 
                                                        |
| 5534 | + $more .= $input['label'].'</div><div class="tagtd left">';  | 
                                                        |
| 5535 | 5535 | }  | 
                                                        
| 5536 | 5536 |  						if ($input['type'] == 'select') { | 
                                                        
| 5537 | 5537 | $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);  | 
                                                        
| 5538 | 5538 |  						} else { | 
                                                        
| 5539 | 5539 | $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);  | 
                                                        
| 5540 | 5540 | }  | 
                                                        
| 5541 | - $more .= '</div></div>' . "\n";  | 
                                                        |
| 5541 | + $more .= '</div></div>'."\n";  | 
                                                        |
| 5542 | 5542 |  					} elseif ($input['type'] == 'checkbox') { | 
                                                        
| 5543 | 5543 | $more .= '<div class="tagtr">';  | 
                                                        
| 5544 | -						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; | 
                                                        |
| 5545 | - $more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr;  | 
                                                        |
| 5544 | +						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; | 
                                                        |
| 5545 | + $more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;  | 
                                                        |
| 5546 | 5546 |  						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { | 
                                                        
| 5547 | 5547 | $more .= ' checked';  | 
                                                        
| 5548 | 5548 | }  | 
                                                        
@@ -5553,19 +5553,19 @@ discard block  | 
                                                    ||
| 5553 | 5553 | $more .= ' disabled';  | 
                                                        
| 5554 | 5554 | }  | 
                                                        
| 5555 | 5555 | $more .= ' /></div>';  | 
                                                        
| 5556 | - $more .= '</div>' . "\n";  | 
                                                        |
| 5556 | + $more .= '</div>'."\n";  | 
                                                        |
| 5557 | 5557 |  					} elseif ($input['type'] == 'radio') { | 
                                                        
| 5558 | 5558 | $i = 0;  | 
                                                        
| 5559 | 5559 |  						foreach ($input['values'] as $selkey => $selval) { | 
                                                        
| 5560 | 5560 | $more .= '<div class="tagtr">';  | 
                                                        
| 5561 | 5561 |  							if (isset($input['label'])) { | 
                                                        
| 5562 | 5562 |  								if ($i == 0) { | 
                                                        
| 5563 | -									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; | 
                                                        |
| 5563 | +									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; | 
                                                        |
| 5564 | 5564 |  								} else { | 
                                                        
| 5565 | -									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; | 
                                                        |
| 5565 | +									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; | 
                                                        |
| 5566 | 5566 | }  | 
                                                        
| 5567 | 5567 | }  | 
                                                        
| 5568 | - $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;  | 
                                                        |
| 5568 | + $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;  | 
                                                        |
| 5569 | 5569 |  							if (!empty($input['disabled'])) { | 
                                                        
| 5570 | 5570 | $more .= ' disabled';  | 
                                                        
| 5571 | 5571 | }  | 
                                                        
@@ -5573,12 +5573,12 @@ discard block  | 
                                                    ||
| 5573 | 5573 | $more .= ' checked="checked"';  | 
                                                        
| 5574 | 5574 | }  | 
                                                        
| 5575 | 5575 | $more .= ' /> ';  | 
                                                        
| 5576 | - $more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>';  | 
                                                        |
| 5577 | - $more .= '</div></div>' . "\n";  | 
                                                        |
| 5576 | + $more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';  | 
                                                        |
| 5577 | + $more .= '</div></div>'."\n";  | 
                                                        |
| 5578 | 5578 | $i++;  | 
                                                        
| 5579 | 5579 | }  | 
                                                        
| 5580 | 5580 |  					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { | 
                                                        
| 5581 | -						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; | 
                                                        |
| 5581 | +						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; | 
                                                        |
| 5582 | 5582 | $more .= '<div class="tagtd">';  | 
                                                        
| 5583 | 5583 | $addnowlink = (empty($input['datenow']) ? 0 : 1);  | 
                                                        
| 5584 | 5584 | $h = $m = 0;  | 
                                                        
@@ -5596,24 +5596,24 @@ discard block  | 
                                                    ||
| 5596 | 5596 |  					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not | 
                                                        
| 5597 | 5597 |  						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; | 
                                                        
| 5598 | 5598 |  						if (!empty($input['label'])) { | 
                                                        
| 5599 | - $more .= $input['label'] . '</div><div class="tagtd">';  | 
                                                        |
| 5599 | + $more .= $input['label'].'</div><div class="tagtd">';  | 
                                                        |
| 5600 | 5600 | }  | 
                                                        
| 5601 | 5601 | $more .= $input['value'];  | 
                                                        
| 5602 | - $more .= '</div></div>' . "\n";  | 
                                                        |
| 5602 | + $more .= '</div></div>'."\n";  | 
                                                        |
| 5603 | 5603 |  					} elseif ($input['type'] == 'onecolumn') { | 
                                                        
| 5604 | 5604 | $moreonecolumn .= '<div class="margintoponly">';  | 
                                                        
| 5605 | 5605 | $moreonecolumn .= $input['value'];  | 
                                                        
| 5606 | - $moreonecolumn .= '</div>' . "\n";  | 
                                                        |
| 5606 | + $moreonecolumn .= '</div>'."\n";  | 
                                                        |
| 5607 | 5607 |  					} elseif ($input['type'] == 'hidden') { | 
                                                        
| 5608 | 5608 | // Do nothing more, already added by a previous loop  | 
                                                        
| 5609 | 5609 |  					} elseif ($input['type'] == 'separator') { | 
                                                        
| 5610 | 5610 | $more .= '<br>';  | 
                                                        
| 5611 | 5611 |  					} else { | 
                                                        
| 5612 | - $more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type';  | 
                                                        |
| 5612 | + $more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';  | 
                                                        |
| 5613 | 5613 | }  | 
                                                        
| 5614 | 5614 | }  | 
                                                        
| 5615 | 5615 | }  | 
                                                        
| 5616 | - $more .= '</div>' . "\n";  | 
                                                        |
| 5616 | + $more .= '</div>'."\n";  | 
                                                        |
| 5617 | 5617 | $more .= $moreonecolumn;  | 
                                                        
| 5618 | 5618 | }  | 
                                                        
| 5619 | 5619 | |
@@ -5635,10 +5635,10 @@ discard block  | 
                                                    ||
| 5635 | 5635 | $button = $useajax;  | 
                                                        
| 5636 | 5636 | $useajax = 1;  | 
                                                        
| 5637 | 5637 | $autoOpen = false;  | 
                                                        
| 5638 | - $dialogconfirm .= '-' . $button;  | 
                                                        |
| 5638 | + $dialogconfirm .= '-'.$button;  | 
                                                        |
| 5639 | 5639 | }  | 
                                                        
| 5640 | -			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; | 
                                                        |
| 5641 | -			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); | 
                                                        |
| 5640 | +			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; | 
                                                        |
| 5641 | +			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); | 
                                                        |
| 5642 | 5642 | |
| 5643 | 5643 | // Add input fields into list of fields to read during submit (inputok and inputko)  | 
                                                        
| 5644 | 5644 |  			if (is_array($formquestion)) { | 
                                                        
@@ -5661,24 +5661,24 @@ discard block  | 
                                                    ||
| 5661 | 5661 | }  | 
                                                        
| 5662 | 5662 | |
| 5663 | 5663 | // Show JQuery confirm box.  | 
                                                        
| 5664 | - $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';  | 
                                                        |
| 5664 | + $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';  | 
                                                        |
| 5665 | 5665 |  			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { | 
                                                        
| 5666 | - $formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n";  | 
                                                        |
| 5666 | + $formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";  | 
                                                        |
| 5667 | 5667 | }  | 
                                                        
| 5668 | 5668 |  			if (!empty($more)) { | 
                                                        
| 5669 | - $formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n";  | 
                                                        |
| 5669 | + $formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n";  | 
                                                        |
| 5670 | 5670 | }  | 
                                                        
| 5671 | - $formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : '');  | 
                                                        |
| 5672 | - $formconfirm .= '</div>' . "\n";  | 
                                                        |
| 5671 | + $formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : '');  | 
                                                        |
| 5672 | + $formconfirm .= '</div>'."\n";  | 
                                                        |
| 5673 | 5673 | |
| 5674 | - $formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n";  | 
                                                        |
| 5675 | - $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";  | 
                                                        |
| 5674 | + $formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";  | 
                                                        |
| 5675 | + $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";  | 
                                                        |
| 5676 | 5676 |  			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; | 
                                                        
| 5677 | 5677 |  			$formconfirm .= 'jQuery(document).ready(function() { | 
                                                        
| 5678 | 5678 |              $(function() { | 
                                                        
| 5679 | - $( "#' . $dialogconfirm . '" ).dialog(  | 
                                                        |
| 5679 | + $( "#' . $dialogconfirm.'" ).dialog(  | 
                                                        |
| 5680 | 5680 |              	{ | 
                                                        
| 5681 | - autoOpen: ' . ($autoOpen ? "true" : "false") . ',';  | 
                                                        |
| 5681 | + autoOpen: ' . ($autoOpen ? "true" : "false").',';  | 
                                                        |
| 5682 | 5682 |  			if ($newselectedchoice == 'no') { | 
                                                        
| 5683 | 5683 | $formconfirm .= '  | 
                                                        
| 5684 | 5684 |  						open: function() { | 
                                                        
@@ -5688,24 +5688,24 @@ discard block  | 
                                                    ||
| 5688 | 5688 | |
| 5689 | 5689 | $jsforcursor = '';  | 
                                                        
| 5690 | 5690 |  			if ($useajax == 1) { | 
                                                        
| 5691 | - $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n";  | 
                                                        |
| 5692 | -				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; | 
                                                        |
| 5691 | + $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";  | 
                                                        |
| 5692 | +				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; | 
                                                        |
| 5693 | 5693 | }  | 
                                                        
| 5694 | 5694 | |
| 5695 | 5695 | $postconfirmas = 'GET';  | 
                                                        
| 5696 | 5696 | |
| 5697 | 5697 | $formconfirm .= '  | 
                                                        
| 5698 | 5698 | resizable: false,  | 
                                                        
| 5699 | - height: "' . $height . '",  | 
                                                        |
| 5700 | - width: "' . $width . '",  | 
                                                        |
| 5699 | + height: "' . $height.'",  | 
                                                        |
| 5700 | + width: "' . $width.'",  | 
                                                        |
| 5701 | 5701 | modal: true,  | 
                                                        
| 5702 | 5702 | closeOnEscape: false,  | 
                                                        
| 5703 | 5703 |                      buttons: { | 
                                                        
| 5704 | -                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { | 
                                                        |
| 5705 | - var options = "token=' . urlencode(newToken()) . '";  | 
                                                        |
| 5706 | - var inputok = ' . json_encode($inputok) . '; /* List of fields into form */  | 
                                                        |
| 5707 | - var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";  | 
                                                        |
| 5708 | - var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";  | 
                                                        |
| 5704 | +                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { | 
                                                        |
| 5705 | + var options = "token=' . urlencode(newToken()).'";  | 
                                                        |
| 5706 | + var inputok = ' . json_encode($inputok).'; /* List of fields into form */  | 
                                                        |
| 5707 | + var page = "' . dol_escape_js(!empty($page) ? $page : '').'";  | 
                                                        |
| 5708 | + var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";  | 
                                                        |
| 5709 | 5709 | |
| 5710 | 5710 |                           	if (inputok.length > 0) { | 
                                                        
| 5711 | 5711 |                           		$.each(inputok, function(i, inputname) { | 
                                                        
@@ -5739,11 +5739,11 @@ discard block  | 
                                                    ||
| 5739 | 5739 | }  | 
                                                        
| 5740 | 5740 |  	                        $(this).dialog("close"); | 
                                                        
| 5741 | 5741 | },  | 
                                                        
| 5742 | -                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { | 
                                                        |
| 5743 | - var options = "token=' . urlencode(newToken()) . '";  | 
                                                        |
| 5744 | - var inputko = ' . json_encode($inputko) . '; /* List of fields into form */  | 
                                                        |
| 5745 | - var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";  | 
                                                        |
| 5746 | - var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";  | 
                                                        |
| 5742 | +                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { | 
                                                        |
| 5743 | + var options = "token=' . urlencode(newToken()).'";  | 
                                                        |
| 5744 | + var inputko = ' . json_encode($inputko).'; /* List of fields into form */  | 
                                                        |
| 5745 | + var page = "' . dol_escape_js(!empty($page) ? $page : '').'";  | 
                                                        |
| 5746 | + var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";  | 
                                                        |
| 5747 | 5747 |                           	if (inputko.length > 0) { | 
                                                        
| 5748 | 5748 |                           		$.each(inputko, function(i, inputname) { | 
                                                        
| 5749 | 5749 | var more = "";  | 
                                                        
@@ -5775,10 +5775,10 @@ discard block  | 
                                                    ||
| 5775 | 5775 | }  | 
                                                        
| 5776 | 5776 | );  | 
                                                        
| 5777 | 5777 | |
| 5778 | - var button = "' . $button . '";  | 
                                                        |
| 5778 | + var button = "' . $button.'";  | 
                                                        |
| 5779 | 5779 |              	if (button.length > 0) { | 
                                                        
| 5780 | 5780 |                  	$( "#" + button ).click(function() { | 
                                                        
| 5781 | -                		$("#' . $dialogconfirm . '").dialog("open"); | 
                                                        |
| 5781 | +                		$("#' . $dialogconfirm.'").dialog("open"); | 
                                                        |
| 5782 | 5782 | });  | 
                                                        
| 5783 | 5783 | }  | 
                                                        
| 5784 | 5784 | });  | 
                                                        
@@ -5786,44 +5786,44 @@ discard block  | 
                                                    ||
| 5786 | 5786 | </script>';  | 
                                                        
| 5787 | 5787 | $formconfirm .= "<!-- end ajax formconfirm -->\n";  | 
                                                        
| 5788 | 5788 |  		} else { | 
                                                        
| 5789 | - $formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n";  | 
                                                        |
| 5789 | + $formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n";  | 
                                                        |
| 5790 | 5790 | |
| 5791 | 5791 |  			if (empty($disableformtag)) { | 
                                                        
| 5792 | - $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";  | 
                                                        |
| 5792 | + $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";  | 
                                                        |
| 5793 | 5793 | }  | 
                                                        
| 5794 | 5794 | |
| 5795 | - $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";  | 
                                                        |
| 5796 | - $formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n";  | 
                                                        |
| 5795 | + $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";  | 
                                                        |
| 5796 | + $formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";  | 
                                                        |
| 5797 | 5797 | |
| 5798 | - $formconfirm .= '<table class="valid centpercent">' . "\n";  | 
                                                        |
| 5798 | + $formconfirm .= '<table class="valid centpercent">'."\n";  | 
                                                        |
| 5799 | 5799 | |
| 5800 | 5800 | // Line title  | 
                                                        
| 5801 | 5801 | $formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">';  | 
                                                        
| 5802 | -			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; | 
                                                        |
| 5803 | - $formconfirm .= '</td></tr>' . "\n";  | 
                                                        |
| 5802 | +			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title; | 
                                                        |
| 5803 | + $formconfirm .= '</td></tr>'."\n";  | 
                                                        |
| 5804 | 5804 | |
| 5805 | 5805 | // Line text  | 
                                                        
| 5806 | 5806 |  			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { | 
                                                        
| 5807 | - $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";  | 
                                                        |
| 5807 | + $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n";  | 
                                                        |
| 5808 | 5808 | }  | 
                                                        
| 5809 | 5809 | |
| 5810 | 5810 | // Line form fields  | 
                                                        
| 5811 | 5811 |  			if ($more) { | 
                                                        
| 5812 | - $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n";  | 
                                                        |
| 5812 | + $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n";  | 
                                                        |
| 5813 | 5813 | $formconfirm .= $more;  | 
                                                        
| 5814 | - $formconfirm .= '</td></tr>' . "\n";  | 
                                                        |
| 5814 | + $formconfirm .= '</td></tr>'."\n";  | 
                                                        |
| 5815 | 5815 | }  | 
                                                        
| 5816 | 5816 | |
| 5817 | 5817 | // Line with question  | 
                                                        
| 5818 | 5818 | $formconfirm .= '<tr class="valid">';  | 
                                                        
| 5819 | - $formconfirm .= '<td class="valid">' . $question . '</td>';  | 
                                                        |
| 5819 | + $formconfirm .= '<td class="valid">'.$question.'</td>';  | 
                                                        |
| 5820 | 5820 | $formconfirm .= '<td class="valid center">';  | 
                                                        
| 5821 | 5821 |  			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); | 
                                                        
| 5822 | -			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; | 
                                                        |
| 5822 | +			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; | 
                                                        |
| 5823 | 5823 | $formconfirm .= '</td>';  | 
                                                        
| 5824 | - $formconfirm .= '</tr>' . "\n";  | 
                                                        |
| 5824 | + $formconfirm .= '</tr>'."\n";  | 
                                                        |
| 5825 | 5825 | |
| 5826 | - $formconfirm .= '</table>' . "\n";  | 
                                                        |
| 5826 | + $formconfirm .= '</table>'."\n";  | 
                                                        |
| 5827 | 5827 | |
| 5828 | 5828 |  			if (empty($disableformtag)) { | 
                                                        
| 5829 | 5829 | $formconfirm .= "</form>\n";  | 
                                                        
@@ -5832,7 +5832,7 @@ discard block  | 
                                                    ||
| 5832 | 5832 | |
| 5833 | 5833 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 5834 | 5834 | $formconfirm .= '<!-- code to disable button to avoid double clic -->';  | 
                                                        
| 5835 | - $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";  | 
                                                        |
| 5835 | + $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";  | 
                                                        |
| 5836 | 5836 | $formconfirm .= '  | 
                                                        
| 5837 | 5837 |  				$(document).ready(function () { | 
                                                        
| 5838 | 5838 |  					$(".confirmvalidatebutton").on("click", function() { | 
                                                        
@@ -5844,7 +5844,7 @@ discard block  | 
                                                    ||
| 5844 | 5844 | });  | 
                                                        
| 5845 | 5845 | });  | 
                                                        
| 5846 | 5846 | ';  | 
                                                        
| 5847 | - $formconfirm .= '</script>' . "\n";  | 
                                                        |
| 5847 | + $formconfirm .= '</script>'."\n";  | 
                                                        |
| 5848 | 5848 | }  | 
                                                        
| 5849 | 5849 | |
| 5850 | 5850 | $formconfirm .= "<!-- end formconfirm -->\n";  | 
                                                        
@@ -5876,8 +5876,8 @@ discard block  | 
                                                    ||
| 5876 | 5876 | // phpcs:enable  | 
                                                        
| 5877 | 5877 | global $langs;  | 
                                                        
| 5878 | 5878 | |
| 5879 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';  | 
                                                        |
| 5880 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';  | 
                                                        |
| 5879 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';  | 
                                                        |
| 5880 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';  | 
                                                        |
| 5881 | 5881 | |
| 5882 | 5882 | $out = '';  | 
                                                        
| 5883 | 5883 | |
@@ -5885,11 +5885,11 @@ discard block  | 
                                                    ||
| 5885 | 5885 | |
| 5886 | 5886 |  		$langs->load("project"); | 
                                                        
| 5887 | 5887 |  		if ($htmlname != "none") { | 
                                                        
| 5888 | - $out .= '<form method="post" action="' . $page . '">';  | 
                                                        |
| 5888 | + $out .= '<form method="post" action="'.$page.'">';  | 
                                                        |
| 5889 | 5889 | $out .= '<input type="hidden" name="action" value="classin">';  | 
                                                        
| 5890 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5890 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5891 | 5891 | $out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss);  | 
                                                        
| 5892 | -			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5892 | +			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5893 | 5893 | $out .= '</form>';  | 
                                                        
| 5894 | 5894 |  		} else { | 
                                                        
| 5895 | 5895 | $out .= '<span class="project_head_block">';  | 
                                                        
@@ -5898,7 +5898,7 @@ discard block  | 
                                                    ||
| 5898 | 5898 | $projet->fetch($selected);  | 
                                                        
| 5899 | 5899 | $out .= $projet->getNomUrl(0, '', 1);  | 
                                                        
| 5900 | 5900 |  			} else { | 
                                                        
| 5901 | - $out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';  | 
                                                        |
| 5901 | + $out .= '<span class="opacitymedium">'.$textifnoproject.'</span>';  | 
                                                        |
| 5902 | 5902 | }  | 
                                                        
| 5903 | 5903 | $out .= '</span>';  | 
                                                        
| 5904 | 5904 | }  | 
                                                        
@@ -5935,14 +5935,14 @@ discard block  | 
                                                    ||
| 5935 | 5935 | $out = '';  | 
                                                        
| 5936 | 5936 | |
| 5937 | 5937 |  		if ($htmlname != "none") { | 
                                                        
| 5938 | - $out .= '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5938 | + $out .= '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5939 | 5939 | $out .= '<input type="hidden" name="action" value="setconditions">';  | 
                                                        
| 5940 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5940 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5941 | 5941 |  			if ($type) { | 
                                                        
| 5942 | - $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        |
| 5942 | + $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        |
| 5943 | 5943 | }  | 
                                                        
| 5944 | 5944 | $out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);  | 
                                                        
| 5945 | -			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5945 | +			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5946 | 5946 | $out .= '</form>';  | 
                                                        
| 5947 | 5947 |  		} else { | 
                                                        
| 5948 | 5948 |  			if ($selected) { | 
                                                        
@@ -5987,12 +5987,12 @@ discard block  | 
                                                    ||
| 5987 | 5987 | // phpcs:enable  | 
                                                        
| 5988 | 5988 | global $langs;  | 
                                                        
| 5989 | 5989 |  		if ($htmlname != "none") { | 
                                                        
| 5990 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 5990 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 5991 | 5991 | print '<input type="hidden" name="action" value="setavailability">';  | 
                                                        
| 5992 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5992 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5993 | 5993 | $this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty);  | 
                                                        
| 5994 | -			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5995 | -			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; | 
                                                        |
| 5994 | +			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5995 | +			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; | 
                                                        |
| 5996 | 5996 | print '</form>';  | 
                                                        
| 5997 | 5997 |  		} else { | 
                                                        
| 5998 | 5998 |  			if ($selected) { | 
                                                        
@@ -6018,11 +6018,11 @@ discard block  | 
                                                    ||
| 6018 | 6018 |  	{ | 
                                                        
| 6019 | 6019 | global $langs;  | 
                                                        
| 6020 | 6020 |  		if ($htmlname != "none") { | 
                                                        
| 6021 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 6021 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 6022 | 6022 | print '<input type="hidden" name="action" value="setdemandreason">';  | 
                                                        
| 6023 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6023 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6024 | 6024 | $this->selectInputReason($selected, $htmlname, -1, $addempty);  | 
                                                        
| 6025 | -			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6025 | +			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6026 | 6026 | print '</form>';  | 
                                                        
| 6027 | 6027 |  		} else { | 
                                                        
| 6028 | 6028 |  			if ($selected) { | 
                                                        
@@ -6062,17 +6062,17 @@ discard block  | 
                                                    ||
| 6062 | 6062 | $ret = '';  | 
                                                        
| 6063 | 6063 | |
| 6064 | 6064 |  		if ($htmlname != "none") { | 
                                                        
| 6065 | - $ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';  | 
                                                        |
| 6066 | - $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';  | 
                                                        |
| 6067 | - $ret .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6065 | + $ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';  | 
                                                        |
| 6066 | + $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';  | 
                                                        |
| 6067 | + $ret .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6068 | 6068 |  			if ($type) { | 
                                                        
| 6069 | - $ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        |
| 6069 | + $ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        |
| 6070 | 6070 | }  | 
                                                        
| 6071 | 6071 | $ret .= '<table class="nobordernopadding">';  | 
                                                        
| 6072 | 6072 | $ret .= '<tr><td>';  | 
                                                        
| 6073 | - $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);  | 
                                                        |
| 6073 | + $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);  | 
                                                        |
| 6074 | 6074 | $ret .= '</td>';  | 
                                                        
| 6075 | -			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; | 
                                                        |
| 6075 | +			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; | 
                                                        |
| 6076 | 6076 | $ret .= '</tr></table></form>';  | 
                                                        
| 6077 | 6077 |  		} else { | 
                                                        
| 6078 | 6078 |  			if ($displayhour) { | 
                                                        
@@ -6107,15 +6107,15 @@ discard block  | 
                                                    ||
| 6107 | 6107 | global $langs;  | 
                                                        
| 6108 | 6108 | |
| 6109 | 6109 |  		if ($htmlname != "none") { | 
                                                        
| 6110 | - print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';  | 
                                                        |
| 6111 | - print '<input type="hidden" name="action" value="set' . $htmlname . '">';  | 
                                                        |
| 6112 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6110 | + print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';  | 
                                                        |
| 6111 | + print '<input type="hidden" name="action" value="set'.$htmlname.'">';  | 
                                                        |
| 6112 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6113 | 6113 | print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);  | 
                                                        
| 6114 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6114 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6115 | 6115 | print '</form>';  | 
                                                        
| 6116 | 6116 |  		} else { | 
                                                        
| 6117 | 6117 |  			if ($selected) { | 
                                                        
| 6118 | - require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';  | 
                                                        |
| 6118 | + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';  | 
                                                        |
| 6119 | 6119 | $theuser = new User($this->db);  | 
                                                        
| 6120 | 6120 | $theuser->fetch($selected);  | 
                                                        
| 6121 | 6121 | print $theuser->getNomUrl(1);  | 
                                                        
@@ -6148,14 +6148,14 @@ discard block  | 
                                                    ||
| 6148 | 6148 | |
| 6149 | 6149 | $out = '';  | 
                                                        
| 6150 | 6150 |  		if ($htmlname != "none") { | 
                                                        
| 6151 | - $out .= '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 6151 | + $out .= '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 6152 | 6152 | $out .= '<input type="hidden" name="action" value="setmode">';  | 
                                                        
| 6153 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6153 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6154 | 6154 |  			if ($type) { | 
                                                        
| 6155 | - $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        |
| 6155 | + $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        |
| 6156 | 6156 | }  | 
                                                        
| 6157 | 6157 | $out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);  | 
                                                        
| 6158 | -			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6158 | +			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6159 | 6159 | $out .= '</form>';  | 
                                                        
| 6160 | 6160 |  		} else { | 
                                                        
| 6161 | 6161 |  			if ($selected) { | 
                                                        
@@ -6188,11 +6188,11 @@ discard block  | 
                                                    ||
| 6188 | 6188 |  	{ | 
                                                        
| 6189 | 6189 | global $langs;  | 
                                                        
| 6190 | 6190 |  		if ($htmlname != "none") { | 
                                                        
| 6191 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 6191 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 6192 | 6192 | print '<input type="hidden" name="action" value="settransportmode">';  | 
                                                        
| 6193 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6193 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6194 | 6194 | $this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);  | 
                                                        
| 6195 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6195 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6196 | 6196 | print '</form>';  | 
                                                        
| 6197 | 6197 |  		} else { | 
                                                        
| 6198 | 6198 |  			if ($selected) { | 
                                                        
@@ -6219,14 +6219,14 @@ discard block  | 
                                                    ||
| 6219 | 6219 | // phpcs:enable  | 
                                                        
| 6220 | 6220 | global $langs;  | 
                                                        
| 6221 | 6221 |  		if ($htmlname != "none") { | 
                                                        
| 6222 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 6222 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 6223 | 6223 | print '<input type="hidden" name="action" value="setmulticurrencycode">';  | 
                                                        
| 6224 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6224 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6225 | 6225 | print $this->selectMultiCurrency($selected, $htmlname, 0);  | 
                                                        
| 6226 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6226 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6227 | 6227 | print '</form>';  | 
                                                        
| 6228 | 6228 |  		} else { | 
                                                        
| 6229 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 6229 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 6230 | 6230 | print !empty($selected) ? currency_name($selected, 1) : ' ';  | 
                                                        
| 6231 | 6231 | }  | 
                                                        
| 6232 | 6232 | }  | 
                                                        
@@ -6248,21 +6248,21 @@ discard block  | 
                                                    ||
| 6248 | 6248 | global $langs, $mysoc, $conf;  | 
                                                        
| 6249 | 6249 | |
| 6250 | 6250 |  		if ($htmlname != "none") { | 
                                                        
| 6251 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 6251 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 6252 | 6252 | print '<input type="hidden" name="action" value="setmulticurrencyrate">';  | 
                                                        
| 6253 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6254 | - print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> ';  | 
                                                        |
| 6253 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6254 | + print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';  | 
                                                        |
| 6255 | 6255 | print '<select name="calculation_mode">';  | 
                                                        
| 6256 | -			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; | 
                                                        |
| 6257 | -			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; | 
                                                        |
| 6256 | +			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; | 
                                                        |
| 6257 | +			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; | 
                                                        |
| 6258 | 6258 | print '</select> ';  | 
                                                        
| 6259 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6259 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6260 | 6260 | print '</form>';  | 
                                                        
| 6261 | 6261 |  		} else { | 
                                                        
| 6262 | 6262 |  			if (!empty($rate)) { | 
                                                        
| 6263 | 6263 | print price($rate, 1, $langs, 0, 0);  | 
                                                        
| 6264 | 6264 |  				if ($currency && $rate != 1) { | 
                                                        
| 6265 | -					print '   (' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')'; | 
                                                        |
| 6265 | +					print '   ('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')'; | 
                                                        |
| 6266 | 6266 | }  | 
                                                        
| 6267 | 6267 |  			} else { | 
                                                        
| 6268 | 6268 | print 1;  | 
                                                        
@@ -6293,9 +6293,9 @@ discard block  | 
                                                    ||
| 6293 | 6293 | // phpcs:enable  | 
                                                        
| 6294 | 6294 | global $conf, $langs;  | 
                                                        
| 6295 | 6295 |  		if ($htmlname != "none") { | 
                                                        
| 6296 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 6296 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 6297 | 6297 | print '<input type="hidden" name="action" value="setabsolutediscount">';  | 
                                                        
| 6298 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6298 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6299 | 6299 | print '<div class="inline-block">';  | 
                                                        
| 6300 | 6300 |  			if (!empty($discount_type)) { | 
                                                        
| 6301 | 6301 |  				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { | 
                                                        
@@ -6333,24 +6333,24 @@ discard block  | 
                                                    ||
| 6333 | 6333 | print '</div>';  | 
                                                        
| 6334 | 6334 |  			if (empty($hidelist)) { | 
                                                        
| 6335 | 6335 | print '<div class="inline-block" style="padding-right: 10px">';  | 
                                                        
| 6336 | - $newfilter = 'discount_type=' . intval($discount_type);  | 
                                                        |
| 6336 | + $newfilter = 'discount_type='.intval($discount_type);  | 
                                                        |
| 6337 | 6337 |  				if (!empty($discount_type)) { | 
                                                        
| 6338 | 6338 | $newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available  | 
                                                        
| 6339 | 6339 |  				} else { | 
                                                        
| 6340 | 6340 | $newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available  | 
                                                        
| 6341 | 6341 | }  | 
                                                        
| 6342 | 6342 |  				if ($filter) { | 
                                                        
| 6343 | -					$newfilter .= ' AND (' . $filter . ')'; | 
                                                        |
| 6343 | +					$newfilter .= ' AND ('.$filter.')'; | 
                                                        |
| 6344 | 6344 | }  | 
                                                        
| 6345 | 6345 | // output the combo of discounts  | 
                                                        
| 6346 | 6346 | $nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue);  | 
                                                        
| 6347 | 6347 |  				if ($nbqualifiedlines > 0) { | 
                                                        
| 6348 | -					print '   <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; | 
                                                        |
| 6348 | +					print '   <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; | 
                                                        |
| 6349 | 6349 |  					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { | 
                                                        
| 6350 | -						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; | 
                                                        |
| 6350 | +						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; | 
                                                        |
| 6351 | 6351 | }  | 
                                                        
| 6352 | 6352 |  					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { | 
                                                        
| 6353 | -						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; | 
                                                        |
| 6353 | +						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; | 
                                                        |
| 6354 | 6354 | }  | 
                                                        
| 6355 | 6355 | |
| 6356 | 6356 | print '>';  | 
                                                        
@@ -6390,23 +6390,23 @@ discard block  | 
                                                    ||
| 6390 | 6390 | global $langs;  | 
                                                        
| 6391 | 6391 | |
| 6392 | 6392 |  		if ($htmlname != "none") { | 
                                                        
| 6393 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 6393 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 6394 | 6394 | print '<input type="hidden" name="action" value="set_contact">';  | 
                                                        
| 6395 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6395 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6396 | 6396 | print '<table class="nobordernopadding">';  | 
                                                        
| 6397 | 6397 | print '<tr><td>';  | 
                                                        
| 6398 | 6398 | print $this->selectcontacts($societe->id, $selected, $htmlname);  | 
                                                        
| 6399 | 6399 | $num = $this->num;  | 
                                                        
| 6400 | 6400 |  			if ($num == 0) { | 
                                                        
| 6401 | 6401 |  				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); | 
                                                        
| 6402 | - print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>';  | 
                                                        |
| 6402 | + print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>';  | 
                                                        |
| 6403 | 6403 | }  | 
                                                        
| 6404 | 6404 | print '</td>';  | 
                                                        
| 6405 | -			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; | 
                                                        |
| 6405 | +			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; | 
                                                        |
| 6406 | 6406 | print '</tr></table></form>';  | 
                                                        
| 6407 | 6407 |  		} else { | 
                                                        
| 6408 | 6408 |  			if ($selected) { | 
                                                        
| 6409 | - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';  | 
                                                        |
| 6409 | + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';  | 
                                                        |
| 6410 | 6410 | $contact = new Contact($this->db);  | 
                                                        
| 6411 | 6411 | $contact->fetch($selected);  | 
                                                        
| 6412 | 6412 | print $contact->getFullName($langs);  | 
                                                        
@@ -6441,20 +6441,20 @@ discard block  | 
                                                    ||
| 6441 | 6441 | |
| 6442 | 6442 | $out = '';  | 
                                                        
| 6443 | 6443 |  		if ($htmlname != "none") { | 
                                                        
| 6444 | - $out .= '<form method="post" action="' . $page . '">';  | 
                                                        |
| 6444 | + $out .= '<form method="post" action="'.$page.'">';  | 
                                                        |
| 6445 | 6445 | $out .= '<input type="hidden" name="action" value="set_thirdparty">';  | 
                                                        
| 6446 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6446 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6447 | 6447 | $out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids);  | 
                                                        
| 6448 | -			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6448 | +			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6449 | 6449 | $out .= '</form>';  | 
                                                        
| 6450 | 6450 |  		} else { | 
                                                        
| 6451 | 6451 |  			if ($selected) { | 
                                                        
| 6452 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        |
| 6452 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        |
| 6453 | 6453 | $soc = new Societe($this->db);  | 
                                                        
| 6454 | 6454 | $soc->fetch($selected);  | 
                                                        
| 6455 | 6455 | $out .= $soc->getNomUrl(0, '');  | 
                                                        
| 6456 | 6456 |  			} else { | 
                                                        
| 6457 | - $out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';  | 
                                                        |
| 6457 | + $out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';  | 
                                                        |
| 6458 | 6458 | }  | 
                                                        
| 6459 | 6459 | }  | 
                                                        
| 6460 | 6460 | |
@@ -6504,22 +6504,22 @@ discard block  | 
                                                    ||
| 6504 | 6504 | $selected = 'EUR'; // Pour compatibilite  | 
                                                        
| 6505 | 6505 | }  | 
                                                        
| 6506 | 6506 | |
| 6507 | - $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 6507 | + $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 6508 | 6508 |  		if ($useempty) { | 
                                                        
| 6509 | 6509 | $out .= '<option value="-1" selected></option>';  | 
                                                        
| 6510 | 6510 | }  | 
                                                        
| 6511 | 6511 |  		foreach ($langs->cache_currencies as $code_iso => $currency) { | 
                                                        
| 6512 | 6512 | $labeltoshow = $currency['label'];  | 
                                                        
| 6513 | 6513 |  			if ($mode == 1) { | 
                                                        
| 6514 | -				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; | 
                                                        |
| 6514 | +				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; | 
                                                        |
| 6515 | 6515 |  			} else { | 
                                                        
| 6516 | -				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; | 
                                                        |
| 6516 | +				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; | 
                                                        |
| 6517 | 6517 | }  | 
                                                        
| 6518 | 6518 | |
| 6519 | 6519 |  			if ($selected && $selected == $code_iso) { | 
                                                        
| 6520 | - $out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">';  | 
                                                        |
| 6520 | + $out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';  | 
                                                        |
| 6521 | 6521 |  			} else { | 
                                                        
| 6522 | - $out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">';  | 
                                                        |
| 6522 | + $out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';  | 
                                                        |
| 6523 | 6523 | }  | 
                                                        
| 6524 | 6524 | $out .= $labeltoshow;  | 
                                                        
| 6525 | 6525 | $out .= '</option>';  | 
                                                        
@@ -6530,7 +6530,7 @@ discard block  | 
                                                    ||
| 6530 | 6530 | }  | 
                                                        
| 6531 | 6531 | |
| 6532 | 6532 | // Make select dynamic  | 
                                                        
| 6533 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 6533 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 6534 | 6534 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 6535 | 6535 | |
| 6536 | 6536 | return $out;  | 
                                                        
@@ -6556,10 +6556,10 @@ discard block  | 
                                                    ||
| 6556 | 6556 | |
| 6557 | 6557 | $TCurrency = array();  | 
                                                        
| 6558 | 6558 | |
| 6559 | - $sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";  | 
                                                        |
| 6560 | -		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; | 
                                                        |
| 6559 | + $sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";  | 
                                                        |
| 6560 | +		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; | 
                                                        |
| 6561 | 6561 |  		if ($filter) { | 
                                                        
| 6562 | - $sql .= " AND " . $filter;  | 
                                                        |
| 6562 | + $sql .= " AND ".$filter;  | 
                                                        |
| 6563 | 6563 | }  | 
                                                        
| 6564 | 6564 | $resql = $this->db->query($sql);  | 
                                                        
| 6565 | 6565 |  		if ($resql) { | 
                                                        
@@ -6569,7 +6569,7 @@ discard block  | 
                                                    ||
| 6569 | 6569 | }  | 
                                                        
| 6570 | 6570 | |
| 6571 | 6571 | $out = '';  | 
                                                        
| 6572 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 6572 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 6573 | 6573 |  		if ($useempty) { | 
                                                        
| 6574 | 6574 | $out .= '<option value=""> </option>';  | 
                                                        
| 6575 | 6575 | }  | 
                                                        
@@ -6581,13 +6581,13 @@ discard block  | 
                                                    ||
| 6581 | 6581 |  			foreach ($langs->cache_currencies as $code_iso => $currency) { | 
                                                        
| 6582 | 6582 |  				if (isset($TCurrency[$code_iso])) { | 
                                                        
| 6583 | 6583 |  					if (!empty($selected) && $selected == $code_iso) { | 
                                                        
| 6584 | - $out .= '<option value="' . $code_iso . '" selected="selected">';  | 
                                                        |
| 6584 | + $out .= '<option value="'.$code_iso.'" selected="selected">';  | 
                                                        |
| 6585 | 6585 |  					} else { | 
                                                        
| 6586 | - $out .= '<option value="' . $code_iso . '">';  | 
                                                        |
| 6586 | + $out .= '<option value="'.$code_iso.'">';  | 
                                                        |
| 6587 | 6587 | }  | 
                                                        
| 6588 | 6588 | |
| 6589 | 6589 | $out .= $currency['label'];  | 
                                                        
| 6590 | -					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; | 
                                                        |
| 6590 | +					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; | 
                                                        |
| 6591 | 6591 | $out .= '</option>';  | 
                                                        
| 6592 | 6592 | }  | 
                                                        
| 6593 | 6593 | }  | 
                                                        
@@ -6596,7 +6596,7 @@ discard block  | 
                                                    ||
| 6596 | 6596 | $out .= '</select>';  | 
                                                        
| 6597 | 6597 | |
| 6598 | 6598 | // Make select dynamic  | 
                                                        
| 6599 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 6599 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 6600 | 6600 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 6601 | 6601 | |
| 6602 | 6602 | return $out;  | 
                                                        
@@ -6627,7 +6627,7 @@ discard block  | 
                                                    ||
| 6627 | 6627 | $sql .= " WHERE t.fk_pays = c.rowid";  | 
                                                        
| 6628 | 6628 | $sql .= " AND t.active > 0";  | 
                                                        
| 6629 | 6629 |  		$sql .= " AND t.entity IN (".getEntity('c_tva').")"; | 
                                                        
| 6630 | -		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; | 
                                                        |
| 6630 | +		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; | 
                                                        |
| 6631 | 6631 | $sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";  | 
                                                        
| 6632 | 6632 | |
| 6633 | 6633 | $resql = $this->db->query($sql);  | 
                                                        
@@ -6639,30 +6639,30 @@ discard block  | 
                                                    ||
| 6639 | 6639 | |
| 6640 | 6640 | $tmparray = array();  | 
                                                        
| 6641 | 6641 | $tmparray['rowid'] = $obj->rowid;  | 
                                                        
| 6642 | - $tmparray['type_vat'] = $obj->type_vat;  | 
                                                        |
| 6643 | - $tmparray['code'] = $obj->code;  | 
                                                        |
| 6642 | + $tmparray['type_vat'] = $obj->type_vat;  | 
                                                        |
| 6643 | + $tmparray['code'] = $obj->code;  | 
                                                        |
| 6644 | 6644 | $tmparray['txtva'] = $obj->taux;  | 
                                                        
| 6645 | - $tmparray['nprtva'] = $obj->recuperableonly;  | 
                                                        |
| 6645 | + $tmparray['nprtva'] = $obj->recuperableonly;  | 
                                                        |
| 6646 | 6646 | $tmparray['localtax1'] = $obj->localtax1;  | 
                                                        
| 6647 | 6647 | $tmparray['localtax1_type'] = $obj->localtax1_type;  | 
                                                        
| 6648 | 6648 | $tmparray['localtax2'] = $obj->localtax2;  | 
                                                        
| 6649 | 6649 | $tmparray['localtax2_type'] = $obj->localtax1_type;  | 
                                                        
| 6650 | -					$tmparray['label']			= $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * | 
                                                        |
| 6651 | -					$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 | 
                                                        |
| 6650 | +					$tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * | 
                                                        |
| 6651 | +					$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 | 
                                                        |
| 6652 | 6652 | $positiverates = '';  | 
                                                        
| 6653 | 6653 |  					if ($obj->taux) { | 
                                                        
| 6654 | - $positiverates .= ($positiverates ? '/' : '') . $obj->taux;  | 
                                                        |
| 6654 | + $positiverates .= ($positiverates ? '/' : '').$obj->taux;  | 
                                                        |
| 6655 | 6655 | }  | 
                                                        
| 6656 | 6656 |  					if ($obj->localtax1) { | 
                                                        
| 6657 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;  | 
                                                        |
| 6657 | + $positiverates .= ($positiverates ? '/' : '').$obj->localtax1;  | 
                                                        |
| 6658 | 6658 | }  | 
                                                        
| 6659 | 6659 |  					if ($obj->localtax2) { | 
                                                        
| 6660 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;  | 
                                                        |
| 6660 | + $positiverates .= ($positiverates ? '/' : '').$obj->localtax2;  | 
                                                        |
| 6661 | 6661 | }  | 
                                                        
| 6662 | 6662 |  					if (empty($positiverates)) { | 
                                                        
| 6663 | 6663 | $positiverates = '0';  | 
                                                        
| 6664 | 6664 | }  | 
                                                        
| 6665 | -					$tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label | 
                                                        |
| 6665 | +					$tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label | 
                                                        |
| 6666 | 6666 | |
| 6667 | 6667 | $this->cache_vatrates[$obj->rowid] = $tmparray;  | 
                                                        
| 6668 | 6668 | }  | 
                                                        
@@ -6682,7 +6682,7 @@ discard block  | 
                                                    ||
| 6682 | 6682 | return -1;  | 
                                                        
| 6683 | 6683 | }  | 
                                                        
| 6684 | 6684 |  		} else { | 
                                                        
| 6685 | - $this->error = '<span class="error">' . $this->db->error() . '</span>';  | 
                                                        |
| 6685 | + $this->error = '<span class="error">'.$this->db->error().'</span>';  | 
                                                        |
| 6686 | 6686 | return -2;  | 
                                                        
| 6687 | 6687 | }  | 
                                                        
| 6688 | 6688 | }  | 
                                                        
@@ -6735,9 +6735,9 @@ discard block  | 
                                                    ||
| 6735 | 6735 | // Check parameters  | 
                                                        
| 6736 | 6736 |  		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { | 
                                                        
| 6737 | 6737 |  			if ($societe_vendeuse->id == $mysoc->id) { | 
                                                        
| 6738 | -				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; | 
                                                        |
| 6738 | +				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; | 
                                                        |
| 6739 | 6739 |  			} else { | 
                                                        
| 6740 | -				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; | 
                                                        |
| 6740 | +				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; | 
                                                        |
| 6741 | 6741 | }  | 
                                                        
| 6742 | 6742 | return $return;  | 
                                                        
| 6743 | 6743 | }  | 
                                                        
@@ -6749,12 +6749,12 @@ discard block  | 
                                                    ||
| 6749 | 6749 | // Define list of countries to use to search VAT rates to show  | 
                                                        
| 6750 | 6750 | // First we defined code_country to use to find list  | 
                                                        
| 6751 | 6751 |  		if (is_object($societe_vendeuse)) { | 
                                                        
| 6752 | - $code_country = "'" . $societe_vendeuse->country_code . "'";  | 
                                                        |
| 6752 | + $code_country = "'".$societe_vendeuse->country_code."'";  | 
                                                        |
| 6753 | 6753 |  		} else { | 
                                                        
| 6754 | - $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente  | 
                                                        |
| 6754 | + $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente  | 
                                                        |
| 6755 | 6755 | }  | 
                                                        
| 6756 | 6756 |  		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on | 
                                                        
| 6757 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 6757 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 6758 | 6758 | // If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries  | 
                                                        
| 6759 | 6759 | // If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country  | 
                                                        
| 6760 | 6760 |  			$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); | 
                                                        
@@ -6764,27 +6764,27 @@ discard block  | 
                                                    ||
| 6764 | 6764 |  					if ($type == 1) { // We know product is a service | 
                                                        
| 6765 | 6765 |  						switch ($selectVatComboMode) { | 
                                                        
| 6766 | 6766 | case '1':  | 
                                                        
| 6767 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6767 | + $code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6768 | 6768 | break;  | 
                                                        
| 6769 | 6769 | case '2':  | 
                                                        
| 6770 | - $code_country = "'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6770 | + $code_country = "'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6771 | 6771 | break;  | 
                                                        
| 6772 | 6772 | }  | 
                                                        
| 6773 | 6773 | }  | 
                                                        
| 6774 | 6774 |  				} elseif (!$idprod) {  // We don't know type of product | 
                                                        
| 6775 | 6775 |  					switch ($selectVatComboMode) { | 
                                                        
| 6776 | 6776 | case '1':  | 
                                                        
| 6777 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6777 | + $code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6778 | 6778 | break;  | 
                                                        
| 6779 | 6779 | case '2':  | 
                                                        
| 6780 | - $code_country = "'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6780 | + $code_country = "'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6781 | 6781 | break;  | 
                                                        
| 6782 | 6782 | }  | 
                                                        
| 6783 | 6783 |  				} else { | 
                                                        
| 6784 | 6784 | $prodstatic = new Product($this->db);  | 
                                                        
| 6785 | 6785 | $prodstatic->fetch($idprod);  | 
                                                        
| 6786 | 6786 |  					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service | 
                                                        
| 6787 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6787 | + $code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6788 | 6788 | }  | 
                                                        
| 6789 | 6789 | }  | 
                                                        
| 6790 | 6790 | }  | 
                                                        
@@ -6846,13 +6846,13 @@ discard block  | 
                                                    ||
| 6846 | 6846 | // Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead  | 
                                                        
| 6847 | 6847 | // of using supplier invoices (this is a very bad idea !)  | 
                                                        
| 6848 | 6848 |  				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { | 
                                                        
| 6849 | -					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; | 
                                                        |
| 6849 | +					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; | 
                                                        |
| 6850 | 6850 | $disabled = true;  | 
                                                        
| 6851 | 6851 | }  | 
                                                        
| 6852 | 6852 | }  | 
                                                        
| 6853 | 6853 | |
| 6854 | 6854 |  			if (!$options_only) { | 
                                                        
| 6855 | - $return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';  | 
                                                        |
| 6855 | + $return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';  | 
                                                        |
| 6856 | 6856 | }  | 
                                                        
| 6857 | 6857 | |
| 6858 | 6858 | $selectedfound = false;  | 
                                                        
@@ -6866,13 +6866,13 @@ discard block  | 
                                                    ||
| 6866 | 6866 | $key = $rate['txtva'];  | 
                                                        
| 6867 | 6867 | $key .= $rate['nprtva'] ? '*' : '';  | 
                                                        
| 6868 | 6868 |  				if ($mode > 0 && $rate['code']) { | 
                                                        
| 6869 | -					$key .= ' (' . $rate['code'] . ')'; | 
                                                        |
| 6869 | +					$key .= ' ('.$rate['code'].')'; | 
                                                        |
| 6870 | 6870 | }  | 
                                                        
| 6871 | 6871 |  				if ($mode < 0) { | 
                                                        
| 6872 | 6872 | $key = $rate['rowid'];  | 
                                                        
| 6873 | 6873 | }  | 
                                                        
| 6874 | 6874 | |
| 6875 | - $return .= '<option value="' . $key . '"';  | 
                                                        |
| 6875 | + $return .= '<option value="'.$key.'"';  | 
                                                        |
| 6876 | 6876 |  				if (!$selectedfound) { | 
                                                        
| 6877 | 6877 |  					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag | 
                                                        
| 6878 | 6878 |  						if ($defaultcode == $rate['code']) { | 
                                                        
@@ -6943,7 +6943,7 @@ discard block  | 
                                                    ||
| 6943 | 6943 | 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 = '')  | 
                                                        
| 6944 | 6944 |  	{ | 
                                                        
| 6945 | 6945 | // phpcs:enable  | 
                                                        
| 6946 | - dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);  | 
                                                        |
| 6946 | + dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);  | 
                                                        |
| 6947 | 6947 | $retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof);  | 
                                                        
| 6948 | 6948 |  		if (!empty($nooutput)) { | 
                                                        
| 6949 | 6949 | return $retstring;  | 
                                                        
@@ -6972,11 +6972,11 @@ discard block  | 
                                                    ||
| 6972 | 6972 |  	{ | 
                                                        
| 6973 | 6973 | global $langs;  | 
                                                        
| 6974 | 6974 | |
| 6975 | -		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); | 
                                                        |
| 6975 | +		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); | 
                                                        |
| 6976 | 6976 |  		if ($forcenewline) { | 
                                                        
| 6977 | 6977 | $ret .= '<br>';  | 
                                                        
| 6978 | 6978 | }  | 
                                                        
| 6979 | -		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); | 
                                                        |
| 6979 | +		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); | 
                                                        |
| 6980 | 6980 | return $ret;  | 
                                                        
| 6981 | 6981 | }  | 
                                                        
| 6982 | 6982 | |
@@ -7042,7 +7042,7 @@ discard block  | 
                                                    ||
| 7042 | 7042 | $orig_set_time = $set_time;  | 
                                                        
| 7043 | 7043 | |
| 7044 | 7044 |  		if ($set_time === '' && $emptydate == 0) { | 
                                                        
| 7045 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';  | 
                                                        |
| 7045 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';  | 
                                                        |
| 7046 | 7046 |  			if ($gm == 'tzuser' || $gm == 'tzuserrel') { | 
                                                        
| 7047 | 7047 | $set_time = dol_now($gm);  | 
                                                        
| 7048 | 7048 |  			} else { | 
                                                        
@@ -7114,38 +7114,38 @@ discard block  | 
                                                    ||
| 7114 | 7114 | // Calendrier popup version eldy  | 
                                                        
| 7115 | 7115 |  				if ($usecalendar == "eldy") { | 
                                                        
| 7116 | 7116 | // Input area to enter date manually  | 
                                                        
| 7117 | - $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"';  | 
                                                        |
| 7117 | + $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';  | 
                                                        |
| 7118 | 7118 | $retstring .= ($disabled ? ' disabled' : '');  | 
                                                        
| 7119 | -					$retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 7119 | +					$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 7120 | 7120 | $retstring .= ' autocomplete="off">';  | 
                                                        
| 7121 | 7121 | |
| 7122 | 7122 | // Icon calendar  | 
                                                        
| 7123 | 7123 | $retstringbuttom = '';  | 
                                                        
| 7124 | 7124 |  					if (!$disabled) { | 
                                                        
| 7125 | - $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';  | 
                                                        |
| 7126 | - $base = DOL_URL_ROOT . '/core/';  | 
                                                        |
| 7127 | -						$retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; | 
                                                        |
| 7128 | -						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        |
| 7125 | + $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';  | 
                                                        |
| 7126 | + $base = DOL_URL_ROOT.'/core/';  | 
                                                        |
| 7127 | +						$retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; | 
                                                        |
| 7128 | +						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        |
| 7129 | 7129 |  					} else { | 
                                                        
| 7130 | -						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        |
| 7130 | +						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        |
| 7131 | 7131 | }  | 
                                                        
| 7132 | - $retstring = $retstringbuttom . $retstring;  | 
                                                        |
| 7132 | + $retstring = $retstringbuttom.$retstring;  | 
                                                        |
| 7133 | 7133 | |
| 7134 | - $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n";  | 
                                                        |
| 7135 | - $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";  | 
                                                        |
| 7136 | - $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n";  | 
                                                        |
| 7134 | + $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";  | 
                                                        |
| 7135 | + $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";  | 
                                                        |
| 7136 | + $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";  | 
                                                        |
| 7137 | 7137 |  				} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') { | 
                                                        
| 7138 | 7138 |  					if (!$disabled && $usecalendar != 'html') { | 
                                                        
| 7139 | 7139 | // Output javascript for datepicker  | 
                                                        
| 7140 | 7140 |  						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100)); | 
                                                        
| 7141 | 7141 |  						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100)); | 
                                                        
| 7142 | 7142 | |
| 7143 | - $retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">';  | 
                                                        |
| 7144 | -						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ | 
                                                        |
| 7145 | -							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', | 
                                                        |
| 7143 | + $retstring .= '<script nonce="'.getNonce().'" type="text/javascript">';  | 
                                                        |
| 7144 | +						$retstring .= "$(function(){ $('#".$prefix."').datepicker({ | 
                                                        |
| 7145 | +							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', | 
                                                        |
| 7146 | 7146 | autoclose: true,  | 
                                                        
| 7147 | 7147 | todayHighlight: true,  | 
                                                        
| 7148 | - yearRange: '" . $minYear . ":" . $maxYear . "',";  | 
                                                        |
| 7148 | + yearRange: '" . $minYear.":".$maxYear."',";  | 
                                                        |
| 7149 | 7149 |  						if (!empty($conf->dol_use_jmobile)) { | 
                                                        
| 7150 | 7150 | $retstring .= "  | 
                                                        
| 7151 | 7151 |  								beforeShow: function (input, datePicker) { | 
                                                        
@@ -7160,7 +7160,7 @@ discard block  | 
                                                    ||
| 7160 | 7160 |  						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { | 
                                                        
| 7161 | 7161 | $retstring .= "  | 
                                                        
| 7162 | 7162 | showOn: 'button', /* both has problem with autocompletion */  | 
                                                        
| 7163 | - buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png',  | 
                                                        |
| 7163 | + buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png',  | 
                                                        |
| 7164 | 7164 | buttonImageOnly: true";  | 
                                                        
| 7165 | 7165 | }  | 
                                                        
| 7166 | 7166 | $retstring .= "  | 
                                                        
@@ -7172,46 +7172,46 @@ discard block  | 
                                                    ||
| 7172 | 7172 | $retstring .= '<div class="nowraponall inline-block divfordateinput">';  | 
                                                        
| 7173 | 7173 | $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';  | 
                                                        
| 7174 | 7174 | $retstring .= ($disabled ? ' disabled' : '');  | 
                                                        
| 7175 | - $retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');  | 
                                                        |
| 7176 | -					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 7175 | + $retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');  | 
                                                        |
| 7176 | +					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 7177 | 7177 | $retstring .= ' autocomplete="off">';  | 
                                                        
| 7178 | 7178 | |
| 7179 | 7179 | // Icone calendrier  | 
                                                        
| 7180 | 7180 |  					if ($disabled) { | 
                                                        
| 7181 | -						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        |
| 7182 | - $retstring = $retstringbutton . $retstring;  | 
                                                        |
| 7181 | +						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        |
| 7182 | + $retstring = $retstringbutton.$retstring;  | 
                                                        |
| 7183 | 7183 | }  | 
                                                        
| 7184 | 7184 | |
| 7185 | 7185 | $retstring .= '</div>';  | 
                                                        
| 7186 | - $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n";  | 
                                                        |
| 7187 | - $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";  | 
                                                        |
| 7188 | - $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n";  | 
                                                        |
| 7186 | + $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";  | 
                                                        |
| 7187 | + $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";  | 
                                                        |
| 7188 | + $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";  | 
                                                        |
| 7189 | 7189 |  				} else { | 
                                                        
| 7190 | 7190 | $retstring .= "Bad value of MAIN_POPUP_CALENDAR";  | 
                                                        
| 7191 | 7191 | }  | 
                                                        
| 7192 | 7192 |  			} else { | 
                                                        
| 7193 | 7193 | // Show date with combo selects  | 
                                                        
| 7194 | 7194 | // Day  | 
                                                        
| 7195 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';  | 
                                                        |
| 7195 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';  | 
                                                        |
| 7196 | 7196 | |
| 7197 | 7197 |  				if ($emptydate || $set_time == -1) { | 
                                                        
| 7198 | 7198 | $retstring .= '<option value="0" selected> </option>';  | 
                                                        
| 7199 | 7199 | }  | 
                                                        
| 7200 | 7200 | |
| 7201 | 7201 |  				for ($day = 1; $day <= 31; $day++) { | 
                                                        
| 7202 | - $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';  | 
                                                        |
| 7202 | + $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';  | 
                                                        |
| 7203 | 7203 | }  | 
                                                        
| 7204 | 7204 | |
| 7205 | 7205 | $retstring .= "</select>";  | 
                                                        
| 7206 | 7206 | |
| 7207 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';  | 
                                                        |
| 7207 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';  | 
                                                        |
| 7208 | 7208 |  				if ($emptydate || $set_time == -1) { | 
                                                        
| 7209 | 7209 | $retstring .= '<option value="0" selected> </option>';  | 
                                                        
| 7210 | 7210 | }  | 
                                                        
| 7211 | 7211 | |
| 7212 | 7212 | // Month  | 
                                                        
| 7213 | 7213 |  				for ($month = 1; $month <= 12; $month++) { | 
                                                        
| 7214 | - $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';  | 
                                                        |
| 7214 | + $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';  | 
                                                        |
| 7215 | 7215 | $retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");  | 
                                                        
| 7216 | 7216 | $retstring .= "</option>";  | 
                                                        
| 7217 | 7217 | }  | 
                                                        
@@ -7219,13 +7219,13 @@ discard block  | 
                                                    ||
| 7219 | 7219 | |
| 7220 | 7220 | // Year  | 
                                                        
| 7221 | 7221 |  				if ($emptydate || $set_time == -1) { | 
                                                        
| 7222 | -					$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 . '">'; | 
                                                        |
| 7222 | +					$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.'">'; | 
                                                        |
| 7223 | 7223 |  				} else { | 
                                                        
| 7224 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';  | 
                                                        |
| 7224 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';  | 
                                                        |
| 7225 | 7225 | |
| 7226 | 7226 | $syear = (int) $syear;  | 
                                                        
| 7227 | 7227 |  					for ($year = $syear - 10; $year < (int) $syear + 10; $year++) { | 
                                                        
| 7228 | - $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';  | 
                                                        |
| 7228 | + $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';  | 
                                                        |
| 7229 | 7229 | }  | 
                                                        
| 7230 | 7230 | $retstring .= "</select>\n";  | 
                                                        
| 7231 | 7231 | }  | 
                                                        
@@ -7249,15 +7249,15 @@ discard block  | 
                                                    ||
| 7249 | 7249 | }  | 
                                                        
| 7250 | 7250 | }  | 
                                                        
| 7251 | 7251 | // Show hour  | 
                                                        
| 7252 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';  | 
                                                        |
| 7252 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';  | 
                                                        |
| 7253 | 7253 |  			if ($emptyhours) { | 
                                                        
| 7254 | 7254 | $retstring .= '<option value="-1"> </option>';  | 
                                                        
| 7255 | 7255 | }  | 
                                                        
| 7256 | 7256 |  			for ($hour = $hourstart; $hour < $hourend; $hour++) { | 
                                                        
| 7257 | 7257 |  				if (strlen($hour) < 2) { | 
                                                        
| 7258 | - $hour = "0" . $hour;  | 
                                                        |
| 7258 | + $hour = "0".$hour;  | 
                                                        |
| 7259 | 7259 | }  | 
                                                        
| 7260 | - $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour;  | 
                                                        |
| 7260 | + $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;  | 
                                                        |
| 7261 | 7261 | //$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');  | 
                                                        
| 7262 | 7262 | $retstring .= '</option>';  | 
                                                        
| 7263 | 7263 | }  | 
                                                        
@@ -7270,17 +7270,17 @@ discard block  | 
                                                    ||
| 7270 | 7270 | |
| 7271 | 7271 |  		if ($m) { | 
                                                        
| 7272 | 7272 | // Show minutes  | 
                                                        
| 7273 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';  | 
                                                        |
| 7273 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';  | 
                                                        |
| 7274 | 7274 |  			if ($emptyhours) { | 
                                                        
| 7275 | 7275 | $retstring .= '<option value="-1"> </option>';  | 
                                                        
| 7276 | 7276 | }  | 
                                                        
| 7277 | 7277 |  			for ($min = 0; $min < 60; $min += $stepminutes) { | 
                                                        
| 7278 | 7278 |  				$min_str = sprintf("%02d", $min); | 
                                                        
| 7279 | - $retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>';  | 
                                                        |
| 7279 | + $retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>';  | 
                                                        |
| 7280 | 7280 | }  | 
                                                        
| 7281 | 7281 | $retstring .= '</select>';  | 
                                                        
| 7282 | 7282 | |
| 7283 | - $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';  | 
                                                        |
| 7283 | + $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';  | 
                                                        |
| 7284 | 7284 | }  | 
                                                        
| 7285 | 7285 | |
| 7286 | 7286 |  		if ($d && $h) { | 
                                                        
@@ -7303,10 +7303,10 @@ discard block  | 
                                                    ||
| 7303 | 7303 | |
| 7304 | 7304 | // Generate the date part, depending on the use or not of the javascript calendar  | 
                                                        
| 7305 | 7305 |  			if ($addnowlink == 1) { // server time expressed in user time setup | 
                                                        
| 7306 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';  | 
                                                        |
| 7307 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        |
| 7308 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        |
| 7309 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        |
| 7306 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';  | 
                                                        |
| 7307 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        |
| 7308 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        |
| 7309 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        |
| 7310 | 7310 |  			} elseif ($addnowlink == 2) { | 
                                                        
| 7311 | 7311 | /* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.  | 
                                                        
| 7312 | 7312 | * This break application for foreign languages.  | 
                                                        
@@ -7315,10 +7315,10 @@ discard block  | 
                                                    ||
| 7315 | 7315 | $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';  | 
                                                        
| 7316 | 7316 | $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';  | 
                                                        
| 7317 | 7317 | */  | 
                                                        
| 7318 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';  | 
                                                        |
| 7319 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        |
| 7320 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        |
| 7321 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        |
| 7318 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';  | 
                                                        |
| 7319 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        |
| 7320 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        |
| 7321 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        |
| 7322 | 7322 | }  | 
                                                        
| 7323 | 7323 | /*if ($usecalendar == "eldy")  | 
                                                        
| 7324 | 7324 |  			{ | 
                                                        
@@ -7338,11 +7338,11 @@ discard block  | 
                                                    ||
| 7338 | 7338 | }  | 
                                                        
| 7339 | 7339 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';  | 
                                                        
| 7340 | 7340 |  				if ($addnowlink == 1) { | 
                                                        
| 7341 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';  | 
                                                        |
| 7342 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';  | 
                                                        |
| 7341 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';  | 
                                                        |
| 7342 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';  | 
                                                        |
| 7343 | 7343 |  				} elseif ($addnowlink == 2) { | 
                                                        
| 7344 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());';  | 
                                                        |
| 7345 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';  | 
                                                        |
| 7344 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';  | 
                                                        |
| 7345 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';  | 
                                                        |
| 7346 | 7346 | }  | 
                                                        
| 7347 | 7347 | |
| 7348 | 7348 |  				if ($fullday) { | 
                                                        
@@ -7356,11 +7356,11 @@ discard block  | 
                                                    ||
| 7356 | 7356 | }  | 
                                                        
| 7357 | 7357 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';  | 
                                                        
| 7358 | 7358 |  				if ($addnowlink == 1) { | 
                                                        
| 7359 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';  | 
                                                        |
| 7360 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';  | 
                                                        |
| 7359 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';  | 
                                                        |
| 7360 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';  | 
                                                        |
| 7361 | 7361 |  				} elseif ($addnowlink == 2) { | 
                                                        
| 7362 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());';  | 
                                                        |
| 7363 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';  | 
                                                        |
| 7362 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';  | 
                                                        |
| 7363 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';  | 
                                                        |
| 7364 | 7364 | }  | 
                                                        
| 7365 | 7365 |  				if ($fullday) { | 
                                                        
| 7366 | 7366 | $reset_scripts .= ' } ';  | 
                                                        
@@ -7368,7 +7368,7 @@ discard block  | 
                                                    ||
| 7368 | 7368 | }  | 
                                                        
| 7369 | 7369 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick  | 
                                                        
| 7370 | 7370 |  			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { | 
                                                        
| 7371 | - $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';  | 
                                                        |
| 7371 | + $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';  | 
                                                        |
| 7372 | 7372 |  				$retstring .= $langs->trans("Now"); | 
                                                        
| 7373 | 7373 | $retstring .= '</button> ';  | 
                                                        
| 7374 | 7374 | }  | 
                                                        
@@ -7380,16 +7380,16 @@ discard block  | 
                                                    ||
| 7380 | 7380 | $reset_scripts = "";  | 
                                                        
| 7381 | 7381 | |
| 7382 | 7382 | // Generate the date part, depending on the use or not of the javascript calendar  | 
                                                        
| 7383 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');';  | 
                                                        |
| 7384 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        |
| 7385 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        |
| 7386 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        |
| 7383 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';  | 
                                                        |
| 7384 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        |
| 7385 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        |
| 7386 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        |
| 7387 | 7387 | // Update the hour part  | 
                                                        
| 7388 | 7388 |  			if ($h) { | 
                                                        
| 7389 | 7389 |  				if ($fullday) { | 
                                                        
| 7390 | 7390 |  					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; | 
                                                        
| 7391 | 7391 | }  | 
                                                        
| 7392 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';  | 
                                                        |
| 7392 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';  | 
                                                        |
| 7393 | 7393 |  				if ($fullday) { | 
                                                        
| 7394 | 7394 | $reset_scripts .= ' } ';  | 
                                                        
| 7395 | 7395 | }  | 
                                                        
@@ -7399,14 +7399,14 @@ discard block  | 
                                                    ||
| 7399 | 7399 |  				if ($fullday) { | 
                                                        
| 7400 | 7400 |  					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; | 
                                                        
| 7401 | 7401 | }  | 
                                                        
| 7402 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';  | 
                                                        |
| 7402 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';  | 
                                                        |
| 7403 | 7403 |  				if ($fullday) { | 
                                                        
| 7404 | 7404 | $reset_scripts .= ' } ';  | 
                                                        
| 7405 | 7405 | }  | 
                                                        
| 7406 | 7406 | }  | 
                                                        
| 7407 | 7407 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick  | 
                                                        
| 7408 | 7408 |  			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { | 
                                                        
| 7409 | - $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';  | 
                                                        |
| 7409 | + $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';  | 
                                                        |
| 7410 | 7410 |  				$retstring .= $langs->trans("DateStartPlusOne"); | 
                                                        
| 7411 | 7411 | $retstring .= '</button> ';  | 
                                                        
| 7412 | 7412 | }  | 
                                                        
@@ -7464,17 +7464,17 @@ discard block  | 
                                                    ||
| 7464 | 7464 | unset($TDurationTypes[$value]);  | 
                                                        
| 7465 | 7465 | }  | 
                                                        
| 7466 | 7466 | |
| 7467 | - $retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">';  | 
                                                        |
| 7467 | + $retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';  | 
                                                        |
| 7468 | 7468 |  		foreach ($TDurationTypes as $key => $typeduration) { | 
                                                        
| 7469 | - $retstring .= '<option value="' . $key . '"';  | 
                                                        |
| 7469 | + $retstring .= '<option value="'.$key.'"';  | 
                                                        |
| 7470 | 7470 |  			if ($key == $selected) { | 
                                                        
| 7471 | 7471 | $retstring .= " selected";  | 
                                                        
| 7472 | 7472 | }  | 
                                                        
| 7473 | - $retstring .= ">" . $typeduration . "</option>";  | 
                                                        |
| 7473 | + $retstring .= ">".$typeduration."</option>";  | 
                                                        |
| 7474 | 7474 | }  | 
                                                        
| 7475 | 7475 | $retstring .= "</select>";  | 
                                                        
| 7476 | 7476 | |
| 7477 | -		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); | 
                                                        |
| 7477 | +		$retstring .= ajax_combobox('select_'.$prefix.'type_duration'); | 
                                                        |
| 7478 | 7478 | |
| 7479 | 7479 | return $retstring;  | 
                                                        
| 7480 | 7480 | }  | 
                                                        
@@ -7506,30 +7506,30 @@ discard block  | 
                                                    ||
| 7506 | 7506 | |
| 7507 | 7507 | // Hours  | 
                                                        
| 7508 | 7508 |  		if ($iSecond != '') { | 
                                                        
| 7509 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';  | 
                                                        |
| 7509 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';  | 
                                                        |
| 7510 | 7510 | |
| 7511 | 7511 | $hourSelected = convertSecondToTime($iSecond, 'allhour');  | 
                                                        
| 7512 | 7512 | $minSelected = convertSecondToTime($iSecond, 'min');  | 
                                                        
| 7513 | 7513 | }  | 
                                                        
| 7514 | 7514 | |
| 7515 | 7515 |  		if ($typehour == 'select') { | 
                                                        
| 7516 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 7516 | + $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 7517 | 7517 |  			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours | 
                                                        
| 7518 | - $retstring .= '<option value="' . $hour . '"';  | 
                                                        |
| 7518 | + $retstring .= '<option value="'.$hour.'"';  | 
                                                        |
| 7519 | 7519 |  				if (is_numeric($hourSelected) && $hourSelected == $hour) { | 
                                                        
| 7520 | 7520 | $retstring .= " selected";  | 
                                                        
| 7521 | 7521 | }  | 
                                                        
| 7522 | - $retstring .= ">" . $hour . "</option>";  | 
                                                        |
| 7522 | + $retstring .= ">".$hour."</option>";  | 
                                                        |
| 7523 | 7523 | }  | 
                                                        
| 7524 | 7524 | $retstring .= "</select>";  | 
                                                        
| 7525 | 7525 |  		} elseif ($typehour == 'text' || $typehour == 'textselect') { | 
                                                        
| 7526 | -			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; | 
                                                        |
| 7526 | +			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; | 
                                                        |
| 7527 | 7527 |  		} else { | 
                                                        
| 7528 | 7528 | return 'BadValueForParameterTypeHour';  | 
                                                        
| 7529 | 7529 | }  | 
                                                        
| 7530 | 7530 | |
| 7531 | 7531 |  		if ($typehour != 'text') { | 
                                                        
| 7532 | -			$retstring .= ' ' . $langs->trans('HourShort'); | 
                                                        |
| 7532 | +			$retstring .= ' '.$langs->trans('HourShort'); | 
                                                        |
| 7533 | 7533 |  		} else { | 
                                                        
| 7534 | 7534 | $retstring .= '<span class="">:</span>';  | 
                                                        
| 7535 | 7535 | }  | 
                                                        
@@ -7544,21 +7544,21 @@ discard block  | 
                                                    ||
| 7544 | 7544 | }  | 
                                                        
| 7545 | 7545 | |
| 7546 | 7546 |  		if ($typehour == 'select' || $typehour == 'textselect') { | 
                                                        
| 7547 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 7547 | + $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 7548 | 7548 |  			for ($min = 0; $min <= 55; $min += 5) { | 
                                                        
| 7549 | - $retstring .= '<option value="' . $min . '"';  | 
                                                        |
| 7549 | + $retstring .= '<option value="'.$min.'"';  | 
                                                        |
| 7550 | 7550 |  				if (is_numeric($minSelected) && $minSelected == $min) { | 
                                                        
| 7551 | 7551 | $retstring .= ' selected';  | 
                                                        
| 7552 | 7552 | }  | 
                                                        
| 7553 | - $retstring .= '>' . $min . '</option>';  | 
                                                        |
| 7553 | + $retstring .= '>'.$min.'</option>';  | 
                                                        |
| 7554 | 7554 | }  | 
                                                        
| 7555 | 7555 | $retstring .= "</select>";  | 
                                                        
| 7556 | 7556 |  		} elseif ($typehour == 'text') { | 
                                                        
| 7557 | -			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; | 
                                                        |
| 7557 | +			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; | 
                                                        |
| 7558 | 7558 | }  | 
                                                        
| 7559 | 7559 | |
| 7560 | 7560 |  		if ($typehour != 'text') { | 
                                                        
| 7561 | -			$retstring .= ' ' . $langs->trans('MinuteShort'); | 
                                                        |
| 7561 | +			$retstring .= ' '.$langs->trans('MinuteShort'); | 
                                                        |
| 7562 | 7562 | }  | 
                                                        
| 7563 | 7563 | |
| 7564 | 7564 | $retstring .= "</span>";  | 
                                                        
@@ -7606,7 +7606,7 @@ discard block  | 
                                                    ||
| 7606 | 7606 | $placeholder = '';  | 
                                                        
| 7607 | 7607 | |
| 7608 | 7608 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 7609 | - require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';  | 
                                                        |
| 7609 | + require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';  | 
                                                        |
| 7610 | 7610 | $tickettmpselect = new Ticket($this->db);  | 
                                                        
| 7611 | 7611 | $tickettmpselect->fetch($selected);  | 
                                                        
| 7612 | 7612 | $selected_input_value = $tickettmpselect->ref;  | 
                                                        
@@ -7614,17 +7614,17 @@ discard block  | 
                                                    ||
| 7614 | 7614 | }  | 
                                                        
| 7615 | 7615 | |
| 7616 | 7616 | $urloption = '';  | 
                                                        
| 7617 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7617 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7618 | 7618 | |
| 7619 | 7619 |  			if (empty($hidelabel)) { | 
                                                        
| 7620 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 7620 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 7621 | 7621 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 7622 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 7622 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 7623 | 7623 |  				if ($hidelabel == 2) { | 
                                                        
| 7624 | 7624 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7625 | 7625 | }  | 
                                                        
| 7626 | 7626 | }  | 
                                                        
| 7627 | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 7627 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 7628 | 7628 |  			if ($hidelabel == 3) { | 
                                                        
| 7629 | 7629 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7630 | 7630 | }  | 
                                                        
@@ -7668,8 +7668,8 @@ discard block  | 
                                                    ||
| 7668 | 7668 | |
| 7669 | 7669 | $sql = "SELECT ";  | 
                                                        
| 7670 | 7670 | $sql .= $selectFields;  | 
                                                        
| 7671 | - $sql .= " FROM " . $this->db->prefix() . "ticket as p";  | 
                                                        |
| 7672 | -		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; | 
                                                        |
| 7671 | + $sql .= " FROM ".$this->db->prefix()."ticket as p";  | 
                                                        |
| 7672 | +		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; | 
                                                        |
| 7673 | 7673 | |
| 7674 | 7674 | // Add criteria on ref/label  | 
                                                        
| 7675 | 7675 |  		if ($filterkey != '') { | 
                                                        
@@ -7685,7 +7685,7 @@ discard block  | 
                                                    ||
| 7685 | 7685 |  				if ($i > 0) { | 
                                                        
| 7686 | 7686 | $sql .= " AND ";  | 
                                                        
| 7687 | 7687 | }  | 
                                                        
| 7688 | - $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 7688 | + $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 7689 | 7689 | $sql .= ")";  | 
                                                        
| 7690 | 7690 | $i++;  | 
                                                        
| 7691 | 7691 | }  | 
                                                        
@@ -7698,22 +7698,22 @@ discard block  | 
                                                    ||
| 7698 | 7698 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 7699 | 7699 | |
| 7700 | 7700 | // Build output string  | 
                                                        
| 7701 | - dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG);  | 
                                                        |
| 7701 | + dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG);  | 
                                                        |
| 7702 | 7702 | $result = $this->db->query($sql);  | 
                                                        
| 7703 | 7703 |  		if ($result) { | 
                                                        
| 7704 | - require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';  | 
                                                        |
| 7705 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';  | 
                                                        |
| 7704 | + require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';  | 
                                                        |
| 7705 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';  | 
                                                        |
| 7706 | 7706 | |
| 7707 | 7707 | $num = $this->db->num_rows($result);  | 
                                                        
| 7708 | 7708 | |
| 7709 | 7709 | $events = array();  | 
                                                        
| 7710 | 7710 | |
| 7711 | 7711 |  			if (!$forcecombo) { | 
                                                        
| 7712 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 7712 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 7713 | 7713 | $out .= ajax_combobox($htmlname, $events, $conf->global->TICKET_USE_SEARCH_TO_SELECT);  | 
                                                        
| 7714 | 7714 | }  | 
                                                        
| 7715 | 7715 | |
| 7716 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 7716 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 7717 | 7717 | |
| 7718 | 7718 | $textifempty = '';  | 
                                                        
| 7719 | 7719 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -7730,7 +7730,7 @@ discard block  | 
                                                    ||
| 7730 | 7730 | }  | 
                                                        
| 7731 | 7731 | }  | 
                                                        
| 7732 | 7732 |  			if ($showempty) { | 
                                                        
| 7733 | - $out .= '<option value="0" selected>' . $textifempty . '</option>';  | 
                                                        |
| 7733 | + $out .= '<option value="0" selected>'.$textifempty.'</option>';  | 
                                                        |
| 7734 | 7734 | }  | 
                                                        
| 7735 | 7735 | |
| 7736 | 7736 | $i = 0;  | 
                                                        
@@ -7785,13 +7785,13 @@ discard block  | 
                                                    ||
| 7785 | 7785 | $outref = $objp->ref;  | 
                                                        
| 7786 | 7786 | $outtype = $objp->fk_product_type;  | 
                                                        
| 7787 | 7787 | |
| 7788 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 7788 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 7789 | 7789 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 7790 | 7790 | $opt .= '>';  | 
                                                        
| 7791 | 7791 | $opt .= $objp->ref;  | 
                                                        
| 7792 | 7792 | $objRef = $objp->ref;  | 
                                                        
| 7793 | 7793 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 7794 | -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7794 | +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7795 | 7795 | }  | 
                                                        
| 7796 | 7796 | |
| 7797 | 7797 | $opt .= "</option>\n";  | 
                                                        
@@ -7832,7 +7832,7 @@ discard block  | 
                                                    ||
| 7832 | 7832 | $placeholder = '';  | 
                                                        
| 7833 | 7833 | |
| 7834 | 7834 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 7835 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 7835 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 7836 | 7836 | $projecttmpselect = new Project($this->db);  | 
                                                        
| 7837 | 7837 | $projecttmpselect->fetch($selected);  | 
                                                        
| 7838 | 7838 | $selected_input_value = $projecttmpselect->ref;  | 
                                                        
@@ -7840,17 +7840,17 @@ discard block  | 
                                                    ||
| 7840 | 7840 | }  | 
                                                        
| 7841 | 7841 | |
| 7842 | 7842 | $urloption = '';  | 
                                                        
| 7843 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7843 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7844 | 7844 | |
| 7845 | 7845 |  			if (empty($hidelabel)) { | 
                                                        
| 7846 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 7846 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 7847 | 7847 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 7848 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 7848 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 7849 | 7849 |  				if ($hidelabel == 2) { | 
                                                        
| 7850 | 7850 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7851 | 7851 | }  | 
                                                        
| 7852 | 7852 | }  | 
                                                        
| 7853 | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 7853 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 7854 | 7854 |  			if ($hidelabel == 3) { | 
                                                        
| 7855 | 7855 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7856 | 7856 | }  | 
                                                        
@@ -7893,8 +7893,8 @@ discard block  | 
                                                    ||
| 7893 | 7893 | |
| 7894 | 7894 | $sql = "SELECT ";  | 
                                                        
| 7895 | 7895 | $sql .= $selectFields;  | 
                                                        
| 7896 | - $sql .= " FROM " . $this->db->prefix() . "projet as p";  | 
                                                        |
| 7897 | -		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; | 
                                                        |
| 7896 | + $sql .= " FROM ".$this->db->prefix()."projet as p";  | 
                                                        |
| 7897 | +		$sql .= ' WHERE p.entity IN ('.getEntity('project').')'; | 
                                                        |
| 7898 | 7898 | |
| 7899 | 7899 | // Add criteria on ref/label  | 
                                                        
| 7900 | 7900 |  		if ($filterkey != '') { | 
                                                        
@@ -7910,7 +7910,7 @@ discard block  | 
                                                    ||
| 7910 | 7910 |  				if ($i > 0) { | 
                                                        
| 7911 | 7911 | $sql .= " AND ";  | 
                                                        
| 7912 | 7912 | }  | 
                                                        
| 7913 | - $sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 7913 | + $sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 7914 | 7914 | $sql .= "";  | 
                                                        
| 7915 | 7915 | $i++;  | 
                                                        
| 7916 | 7916 | }  | 
                                                        
@@ -7923,22 +7923,22 @@ discard block  | 
                                                    ||
| 7923 | 7923 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 7924 | 7924 | |
| 7925 | 7925 | // Build output string  | 
                                                        
| 7926 | - dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG);  | 
                                                        |
| 7926 | + dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);  | 
                                                        |
| 7927 | 7927 | $result = $this->db->query($sql);  | 
                                                        
| 7928 | 7928 |  		if ($result) { | 
                                                        
| 7929 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 7930 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';  | 
                                                        |
| 7929 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 7930 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';  | 
                                                        |
| 7931 | 7931 | |
| 7932 | 7932 | $num = $this->db->num_rows($result);  | 
                                                        
| 7933 | 7933 | |
| 7934 | 7934 | $events = array();  | 
                                                        
| 7935 | 7935 | |
| 7936 | 7936 |  			if (!$forcecombo) { | 
                                                        
| 7937 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 7937 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 7938 | 7938 | $out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);  | 
                                                        
| 7939 | 7939 | }  | 
                                                        
| 7940 | 7940 | |
| 7941 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 7941 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 7942 | 7942 | |
| 7943 | 7943 | $textifempty = '';  | 
                                                        
| 7944 | 7944 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -7955,7 +7955,7 @@ discard block  | 
                                                    ||
| 7955 | 7955 | }  | 
                                                        
| 7956 | 7956 | }  | 
                                                        
| 7957 | 7957 |  			if ($showempty) { | 
                                                        
| 7958 | - $out .= '<option value="0" selected>' . $textifempty . '</option>';  | 
                                                        |
| 7958 | + $out .= '<option value="0" selected>'.$textifempty.'</option>';  | 
                                                        |
| 7959 | 7959 | }  | 
                                                        
| 7960 | 7960 | |
| 7961 | 7961 | $i = 0;  | 
                                                        
@@ -8013,13 +8013,13 @@ discard block  | 
                                                    ||
| 8013 | 8013 | $outlabel = $objp->label;  | 
                                                        
| 8014 | 8014 | $outtype = $objp->fk_product_type;  | 
                                                        
| 8015 | 8015 | |
| 8016 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 8016 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 8017 | 8017 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 8018 | 8018 | $opt .= '>';  | 
                                                        
| 8019 | 8019 | $opt .= $objp->ref;  | 
                                                        
| 8020 | 8020 | $objRef = $objp->ref;  | 
                                                        
| 8021 | 8021 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 8022 | -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 8022 | +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 8023 | 8023 | }  | 
                                                        
| 8024 | 8024 | |
| 8025 | 8025 | $opt .= "</option>\n";  | 
                                                        
@@ -8061,7 +8061,7 @@ discard block  | 
                                                    ||
| 8061 | 8061 | $placeholder = '';  | 
                                                        
| 8062 | 8062 | |
| 8063 | 8063 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 8064 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';  | 
                                                        |
| 8064 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';  | 
                                                        |
| 8065 | 8065 | $adherenttmpselect = new Adherent($this->db);  | 
                                                        
| 8066 | 8066 | $adherenttmpselect->fetch($selected);  | 
                                                        
| 8067 | 8067 | $selected_input_value = $adherenttmpselect->ref;  | 
                                                        
@@ -8070,17 +8070,17 @@ discard block  | 
                                                    ||
| 8070 | 8070 | |
| 8071 | 8071 | $urloption = '';  | 
                                                        
| 8072 | 8072 | |
| 8073 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 8073 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 8074 | 8074 | |
| 8075 | 8075 |  			if (empty($hidelabel)) { | 
                                                        
| 8076 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 8076 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 8077 | 8077 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 8078 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 8078 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 8079 | 8079 |  				if ($hidelabel == 2) { | 
                                                        
| 8080 | 8080 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 8081 | 8081 | }  | 
                                                        
| 8082 | 8082 | }  | 
                                                        
| 8083 | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 8083 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 8084 | 8084 |  			if ($hidelabel == 3) { | 
                                                        
| 8085 | 8085 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 8086 | 8086 | }  | 
                                                        
@@ -8125,8 +8125,8 @@ discard block  | 
                                                    ||
| 8125 | 8125 | |
| 8126 | 8126 | $sql = "SELECT ";  | 
                                                        
| 8127 | 8127 | $sql .= $selectFields;  | 
                                                        
| 8128 | - $sql .= " FROM " . $this->db->prefix() . "adherent as p";  | 
                                                        |
| 8129 | -		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; | 
                                                        |
| 8128 | + $sql .= " FROM ".$this->db->prefix()."adherent as p";  | 
                                                        |
| 8129 | +		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; | 
                                                        |
| 8130 | 8130 | |
| 8131 | 8131 | // Add criteria on ref/label  | 
                                                        
| 8132 | 8132 |  		if ($filterkey != '') { | 
                                                        
@@ -8142,8 +8142,8 @@ discard block  | 
                                                    ||
| 8142 | 8142 |  				if ($i > 0) { | 
                                                        
| 8143 | 8143 | $sql .= " AND ";  | 
                                                        
| 8144 | 8144 | }  | 
                                                        
| 8145 | - $sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 8146 | - $sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";  | 
                                                        |
| 8145 | + $sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 8146 | + $sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";  | 
                                                        |
| 8147 | 8147 | $i++;  | 
                                                        
| 8148 | 8148 | }  | 
                                                        
| 8149 | 8149 |  			if (count($search_crit) > 1) { | 
                                                        
@@ -8152,27 +8152,27 @@ discard block  | 
                                                    ||
| 8152 | 8152 | $sql .= ')';  | 
                                                        
| 8153 | 8153 | }  | 
                                                        
| 8154 | 8154 |  		if ($status != -1) { | 
                                                        
| 8155 | - $sql .= ' AND statut = ' . ((int) $status);  | 
                                                        |
| 8155 | + $sql .= ' AND statut = '.((int) $status);  | 
                                                        |
| 8156 | 8156 | }  | 
                                                        
| 8157 | 8157 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 8158 | 8158 | |
| 8159 | 8159 | // Build output string  | 
                                                        
| 8160 | - dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG);  | 
                                                        |
| 8160 | + dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);  | 
                                                        |
| 8161 | 8161 | $result = $this->db->query($sql);  | 
                                                        
| 8162 | 8162 |  		if ($result) { | 
                                                        
| 8163 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';  | 
                                                        |
| 8164 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';  | 
                                                        |
| 8163 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';  | 
                                                        |
| 8164 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';  | 
                                                        |
| 8165 | 8165 | |
| 8166 | 8166 | $num = $this->db->num_rows($result);  | 
                                                        
| 8167 | 8167 | |
| 8168 | 8168 | $events = array();  | 
                                                        
| 8169 | 8169 | |
| 8170 | 8170 |  			if (!$forcecombo) { | 
                                                        
| 8171 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 8171 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 8172 | 8172 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); | 
                                                        
| 8173 | 8173 | }  | 
                                                        
| 8174 | 8174 | |
| 8175 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 8175 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 8176 | 8176 | |
| 8177 | 8177 | $textifempty = '';  | 
                                                        
| 8178 | 8178 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -8189,7 +8189,7 @@ discard block  | 
                                                    ||
| 8189 | 8189 | }  | 
                                                        
| 8190 | 8190 | }  | 
                                                        
| 8191 | 8191 |  			if ($showempty) { | 
                                                        
| 8192 | - $out .= '<option value="-1" selected>' . $textifempty . '</option>';  | 
                                                        |
| 8192 | + $out .= '<option value="-1" selected>'.$textifempty.'</option>';  | 
                                                        |
| 8193 | 8193 | }  | 
                                                        
| 8194 | 8194 | |
| 8195 | 8195 | $i = 0;  | 
                                                        
@@ -8245,11 +8245,11 @@ discard block  | 
                                                    ||
| 8245 | 8245 | $outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname);  | 
                                                        
| 8246 | 8246 | $outtype = $objp->fk_adherent_type;  | 
                                                        
| 8247 | 8247 | |
| 8248 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 8248 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 8249 | 8249 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 8250 | 8250 | $opt .= '>';  | 
                                                        
| 8251 | 8251 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 8252 | -			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); | 
                                                        |
| 8252 | +			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); | 
                                                        |
| 8253 | 8253 | }  | 
                                                        
| 8254 | 8254 | $opt .= $outlabel;  | 
                                                        
| 8255 | 8255 | $opt .= "</option>\n";  | 
                                                        
@@ -8287,8 +8287,8 @@ discard block  | 
                                                    ||
| 8287 | 8287 | $objecttmp = null;  | 
                                                        
| 8288 | 8288 | $InfoFieldList = array();  | 
                                                        
| 8289 | 8289 | $classname = '';  | 
                                                        
| 8290 | - $filter = ''; // Ensure filter has value (for static analysis)  | 
                                                        |
| 8291 | - $sortfield = ''; // Ensure filter has value (for static analysis)  | 
                                                        |
| 8290 | + $filter = ''; // Ensure filter has value (for static analysis)  | 
                                                        |
| 8291 | + $sortfield = ''; // Ensure filter has value (for static analysis)  | 
                                                        |
| 8292 | 8292 | |
| 8293 | 8293 |  		if ($objectfield) {	// We must retrieve the objectdesc from the field or extrafield | 
                                                        
| 8294 | 8294 | // Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield'  | 
                                                        
@@ -8332,9 +8332,9 @@ discard block  | 
                                                    ||
| 8332 | 8332 | $vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);  | 
                                                        
| 8333 | 8333 | $reg = array();  | 
                                                        
| 8334 | 8334 |  			if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { | 
                                                        
| 8335 | - $InfoFieldList[4] = $reg[1]; // take the sort field  | 
                                                        |
| 8335 | + $InfoFieldList[4] = $reg[1]; // take the sort field  | 
                                                        |
| 8336 | 8336 | }  | 
                                                        
| 8337 | -			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field | 
                                                        |
| 8337 | +			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field | 
                                                        |
| 8338 | 8338 | |
| 8339 | 8339 | $classname = $InfoFieldList[0];  | 
                                                        
| 8340 | 8340 | $classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1];  | 
                                                        
@@ -8365,8 +8365,8 @@ discard block  | 
                                                    ||
| 8365 | 8365 | );  | 
                                                        
| 8366 | 8366 | |
| 8367 | 8367 |  		if (!is_object($objecttmp)) { | 
                                                        
| 8368 | -			dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); | 
                                                        |
| 8369 | - return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;  | 
                                                        |
| 8368 | +			dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); | 
                                                        |
| 8369 | + return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;  | 
                                                        |
| 8370 | 8370 | }  | 
                                                        
| 8371 | 8371 | '@phan-var-force CommonObject $objecttmp';  | 
                                                        
| 8372 | 8372 | |
@@ -8378,9 +8378,9 @@ discard block  | 
                                                    ||
| 8378 | 8378 |  		if ($prefixforautocompletemode == 'product') { | 
                                                        
| 8379 | 8379 | $prefixforautocompletemode = 'produit';  | 
                                                        
| 8380 | 8380 | }  | 
                                                        
| 8381 | - $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8381 | + $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8382 | 8382 | |
| 8383 | - dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);  | 
                                                        |
| 8383 | + dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG);  | 
                                                        |
| 8384 | 8384 | |
| 8385 | 8385 | // Generate the combo HTML component  | 
                                                        
| 8386 | 8386 | $out = '';  | 
                                                        
@@ -8409,13 +8409,13 @@ discard block  | 
                                                    ||
| 8409 | 8409 | }  | 
                                                        
| 8410 | 8410 | |
| 8411 | 8411 | // Set url and param to call to get json of the search results  | 
                                                        
| 8412 | - $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';  | 
                                                        |
| 8413 | - $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');  | 
                                                        |
| 8412 | + $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';  | 
                                                        |
| 8413 | + $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : '');  | 
                                                        |
| 8414 | 8414 | |
| 8415 | 8415 | // Activate the auto complete using ajax call.  | 
                                                        
| 8416 | 8416 | $out .= ajax_autocompleter($preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalInt($confkeyforautocompletemode), 0);  | 
                                                        
| 8417 | 8417 |  			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                        
| 8418 | - $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) . '"' : '') . ' />';  | 
                                                        |
| 8418 | + $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).'"' : '').' />';  | 
                                                        |
| 8419 | 8419 |  		} else { | 
                                                        
| 8420 | 8420 | // Immediate load of table record.  | 
                                                        
| 8421 | 8421 | $out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);  | 
                                                        
@@ -8455,16 +8455,16 @@ discard block  | 
                                                    ||
| 8455 | 8455 |  		if ($prefixforautocompletemode == 'societe') { | 
                                                        
| 8456 | 8456 | $prefixforautocompletemode = 'company';  | 
                                                        
| 8457 | 8457 | }  | 
                                                        
| 8458 | - $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8458 | + $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8459 | 8459 | |
| 8460 | 8460 |  		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...) | 
                                                        
| 8461 | 8461 | $tmpfieldstoshow = '';  | 
                                                        
| 8462 | 8462 |  			foreach ($objecttmp->fields as $key => $val) { | 
                                                        
| 8463 | -				if (! (int) dol_eval($val['enabled'], 1, 1, '1')) { | 
                                                        |
| 8463 | +				if (!(int) dol_eval($val['enabled'], 1, 1, '1')) { | 
                                                        |
| 8464 | 8464 | continue;  | 
                                                        
| 8465 | 8465 | }  | 
                                                        
| 8466 | 8466 |  				if (!empty($val['showoncombobox'])) { | 
                                                        
| 8467 | - $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;  | 
                                                        |
| 8467 | + $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;  | 
                                                        |
| 8468 | 8468 | }  | 
                                                        
| 8469 | 8469 | }  | 
                                                        
| 8470 | 8470 |  			if ($tmpfieldstoshow) { | 
                                                        
@@ -8492,18 +8492,18 @@ discard block  | 
                                                    ||
| 8492 | 8492 | $num = 0;  | 
                                                        
| 8493 | 8493 | |
| 8494 | 8494 | // Search data  | 
                                                        
| 8495 | - $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t";  | 
                                                        |
| 8495 | + $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t";  | 
                                                        |
| 8496 | 8496 |  		if (!empty($objecttmp->isextrafieldmanaged)) { | 
                                                        
| 8497 | - $sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object";  | 
                                                        |
| 8497 | + $sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object";  | 
                                                        |
| 8498 | 8498 | }  | 
                                                        
| 8499 | 8499 |  		if (isset($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8500 | 8500 |  			if (!is_numeric($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8501 | 8501 |  				$tmparray = explode('@', $objecttmp->ismultientitymanaged); | 
                                                        
| 8502 | - $sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0];  | 
                                                        |
| 8502 | + $sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];  | 
                                                        |
| 8503 | 8503 | }  | 
                                                        
| 8504 | 8504 |  			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { | 
                                                        
| 8505 | 8505 |  				if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 8506 | - $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";  | 
                                                        |
| 8506 | + $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";  | 
                                                        |
| 8507 | 8507 | }  | 
                                                        
| 8508 | 8508 | }  | 
                                                        
| 8509 | 8509 | }  | 
                                                        
@@ -8523,21 +8523,21 @@ discard block  | 
                                                    ||
| 8523 | 8523 | $sql .= " WHERE 1=1";  | 
                                                        
| 8524 | 8524 |  			if (isset($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8525 | 8525 |  				if ($objecttmp->ismultientitymanaged == 1) { | 
                                                        
| 8526 | -					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; | 
                                                        |
| 8526 | +					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; | 
                                                        |
| 8527 | 8527 | }  | 
                                                        
| 8528 | 8528 |  				if (!is_numeric($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8529 | - $sql .= " AND parenttable.entity = t." . $tmparray[0];  | 
                                                        |
| 8529 | + $sql .= " AND parenttable.entity = t.".$tmparray[0];  | 
                                                        |
| 8530 | 8530 | }  | 
                                                        
| 8531 | 8531 |  				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { | 
                                                        
| 8532 | 8532 |  					if ($objecttmp->element == 'societe') { | 
                                                        
| 8533 | - $sql .= " AND t.rowid = " . ((int) $user->socid);  | 
                                                        |
| 8533 | + $sql .= " AND t.rowid = ".((int) $user->socid);  | 
                                                        |
| 8534 | 8534 |  					} else { | 
                                                        
| 8535 | - $sql .= " AND t.fk_soc = " . ((int) $user->socid);  | 
                                                        |
| 8535 | + $sql .= " AND t.fk_soc = ".((int) $user->socid);  | 
                                                        |
| 8536 | 8536 | }  | 
                                                        
| 8537 | 8537 | }  | 
                                                        
| 8538 | 8538 |  				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { | 
                                                        
| 8539 | 8539 |  					if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 8540 | - $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);  | 
                                                        |
| 8540 | + $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);  | 
                                                        |
| 8541 | 8541 | }  | 
                                                        
| 8542 | 8542 | }  | 
                                                        
| 8543 | 8543 | }  | 
                                                        
@@ -8549,7 +8549,7 @@ discard block  | 
                                                    ||
| 8549 | 8549 | $errormessage = '';  | 
                                                        
| 8550 | 8550 | $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);  | 
                                                        
| 8551 | 8551 |  				if ($errormessage) { | 
                                                        
| 8552 | - return 'Error forging a SQL request from an universal criteria: ' . $errormessage;  | 
                                                        |
| 8552 | + return 'Error forging a SQL request from an universal criteria: '.$errormessage;  | 
                                                        |
| 8553 | 8553 | }  | 
                                                        
| 8554 | 8554 | }  | 
                                                        
| 8555 | 8555 | }  | 
                                                        
@@ -8561,7 +8561,7 @@ discard block  | 
                                                    ||
| 8561 | 8561 | $resql = $this->db->query($sql);  | 
                                                        
| 8562 | 8562 |  		if ($resql) { | 
                                                        
| 8563 | 8563 | // Construct $out and $outarray  | 
                                                        
| 8564 | - $out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";  | 
                                                        |
| 8564 | + $out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";  | 
                                                        |
| 8565 | 8565 | |
| 8566 | 8566 | // Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4  | 
                                                        
| 8567 | 8567 | $textifempty = ' ';  | 
                                                        
@@ -8575,7 +8575,7 @@ discard block  | 
                                                    ||
| 8575 | 8575 | }  | 
                                                        
| 8576 | 8576 | }  | 
                                                        
| 8577 | 8577 |  			if ($showempty) { | 
                                                        
| 8578 | - $out .= '<option value="-1">' . $textifempty . '</option>' . "\n";  | 
                                                        |
| 8578 | + $out .= '<option value="-1">'.$textifempty.'</option>'."\n";  | 
                                                        |
| 8579 | 8579 | }  | 
                                                        
| 8580 | 8580 | |
| 8581 | 8581 | $num = $this->db->num_rows($resql);  | 
                                                        
@@ -8598,9 +8598,9 @@ discard block  | 
                                                    ||
| 8598 | 8598 | }  | 
                                                        
| 8599 | 8599 |  					if (empty($outputmode)) { | 
                                                        
| 8600 | 8600 |  						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { | 
                                                        
| 8601 | - $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>';  | 
                                                        |
| 8601 | + $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>';  | 
                                                        |
| 8602 | 8602 |  						} else { | 
                                                        
| 8603 | - $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';  | 
                                                        |
| 8603 | + $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';  | 
                                                        |
| 8604 | 8604 | }  | 
                                                        
| 8605 | 8605 |  					} else { | 
                                                        
| 8606 | 8606 |  						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); | 
                                                        
@@ -8613,10 +8613,10 @@ discard block  | 
                                                    ||
| 8613 | 8613 | }  | 
                                                        
| 8614 | 8614 | }  | 
                                                        
| 8615 | 8615 | |
| 8616 | - $out .= '</select>' . "\n";  | 
                                                        |
| 8616 | + $out .= '</select>'."\n";  | 
                                                        |
| 8617 | 8617 | |
| 8618 | 8618 |  			if (!$forcecombo) { | 
                                                        
| 8619 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 8619 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 8620 | 8620 | $out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0));  | 
                                                        
| 8621 | 8621 | }  | 
                                                        
| 8622 | 8622 |  		} else { | 
                                                        
@@ -8680,8 +8680,8 @@ discard block  | 
                                                    ||
| 8680 | 8680 | }  | 
                                                        
| 8681 | 8681 | }  | 
                                                        
| 8682 | 8682 |  		$idname = str_replace(array('[', ']'), array('', ''), $htmlname); | 
                                                        
| 8683 | -		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; | 
                                                        |
| 8684 | -		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); | 
                                                        |
| 8683 | +		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; | 
                                                        |
| 8684 | +		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); | 
                                                        |
| 8685 | 8685 | $out .= '>'."\n";  | 
                                                        
| 8686 | 8686 | |
| 8687 | 8687 |  		if ($show_empty) { | 
                                                        
@@ -8692,7 +8692,7 @@ discard block  | 
                                                    ||
| 8692 | 8692 |  			if (!is_numeric($show_empty)) { | 
                                                        
| 8693 | 8693 | $textforempty = $show_empty;  | 
                                                        
| 8694 | 8694 | }  | 
                                                        
| 8695 | - $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";  | 
                                                        |
| 8695 | + $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";  | 
                                                        |
| 8696 | 8696 | }  | 
                                                        
| 8697 | 8697 |  		if (is_array($array)) { | 
                                                        
| 8698 | 8698 | // Translate  | 
                                                        
@@ -8717,7 +8717,7 @@ discard block  | 
                                                    ||
| 8717 | 8717 | $value = $tmpvalue['label'];  | 
                                                        
| 8718 | 8718 | //$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html'];  | 
                                                        
| 8719 | 8719 | $disabled = empty($tmpvalue['disabled']) ? '' : ' disabled';  | 
                                                        
| 8720 | - $style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"';  | 
                                                        |
| 8720 | + $style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"';  | 
                                                        |
| 8721 | 8721 |  				} else { | 
                                                        
| 8722 | 8722 | $value = $tmpvalue;  | 
                                                        
| 8723 | 8723 | //$valuehtml = $tmpvalue;  | 
                                                        
@@ -8733,9 +8733,9 @@ discard block  | 
                                                    ||
| 8733 | 8733 | }  | 
                                                        
| 8734 | 8734 |  				if ($key_in_label) { | 
                                                        
| 8735 | 8735 |  					if (empty($nohtmlescape)) { | 
                                                        
| 8736 | - $selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));  | 
                                                        |
| 8736 | + $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));  | 
                                                        |
| 8737 | 8737 |  					} else { | 
                                                        
| 8738 | - $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);  | 
                                                        |
| 8738 | + $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);  | 
                                                        |
| 8739 | 8739 | }  | 
                                                        
| 8740 | 8740 |  				} else { | 
                                                        
| 8741 | 8741 |  					if (empty($nohtmlescape)) { | 
                                                        
@@ -8747,8 +8747,8 @@ discard block  | 
                                                    ||
| 8747 | 8747 | $selectOptionValue = ' ';  | 
                                                        
| 8748 | 8748 | }  | 
                                                        
| 8749 | 8749 | }  | 
                                                        
| 8750 | - $out .= '<option value="' . $key . '"';  | 
                                                        |
| 8751 | - $out .= $style . $disabled;  | 
                                                        |
| 8750 | + $out .= '<option value="'.$key.'"';  | 
                                                        |
| 8751 | + $out .= $style.$disabled;  | 
                                                        |
| 8752 | 8752 |  				if (is_array($id)) { | 
                                                        
| 8753 | 8753 |  					if (in_array($key, $id) && !$disabled) { | 
                                                        
| 8754 | 8754 | $out .= ' selected'; // To preselect a value  | 
                                                        
@@ -8760,7 +8760,7 @@ discard block  | 
                                                    ||
| 8760 | 8760 | }  | 
                                                        
| 8761 | 8761 | }  | 
                                                        
| 8762 | 8762 |  				if (!empty($nohtmlescape)) {	// deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content. | 
                                                        
| 8763 | - $out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"';  | 
                                                        |
| 8763 | + $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';  | 
                                                        |
| 8764 | 8764 | }  | 
                                                        
| 8765 | 8765 | |
| 8766 | 8766 |  				if (is_array($tmpvalue)) { | 
                                                        
@@ -8783,7 +8783,7 @@ discard block  | 
                                                    ||
| 8783 | 8783 | // Add code for jquery to use multiselect  | 
                                                        
| 8784 | 8784 |  		if ($addjscombo && $jsbeautify) { | 
                                                        
| 8785 | 8785 | // Enhance with select2  | 
                                                        
| 8786 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 8786 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 8787 | 8787 | $out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss);  | 
                                                        
| 8788 | 8788 | }  | 
                                                        
| 8789 | 8789 | |
@@ -8811,28 +8811,28 @@ discard block  | 
                                                    ||
| 8811 | 8811 | public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)  | 
                                                        
| 8812 | 8812 |  	{ | 
                                                        
| 8813 | 8813 | global $conf, $langs;  | 
                                                        
| 8814 | - global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8814 | + global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8815 | 8815 | |
| 8816 | 8816 | // TODO Use an internal dolibarr component instead of select2  | 
                                                        
| 8817 | 8817 |  		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
| 8818 | 8818 | return '';  | 
                                                        
| 8819 | 8819 | }  | 
                                                        
| 8820 | 8820 | |
| 8821 | - $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';  | 
                                                        |
| 8821 | + $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';  | 
                                                        |
| 8822 | 8822 | |
| 8823 | 8823 | $outdelayed = '';  | 
                                                        
| 8824 | 8824 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 8825 | 8825 | $tmpplugin = 'select2';  | 
                                                        
| 8826 | - $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->  | 
                                                        |
| 8827 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 8826 | + $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->  | 
                                                        |
| 8827 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 8828 | 8828 |  		    	$(document).ready(function () { | 
                                                        
| 8829 | 8829 | |
| 8830 | - ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '  | 
                                                        |
| 8830 | + ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'  | 
                                                        |
| 8831 | 8831 | |
| 8832 | -	                $(".' . $htmlname . '").select2({ | 
                                                        |
| 8832 | +	                $(".' . $htmlname.'").select2({ | 
                                                        |
| 8833 | 8833 |  				    	ajax: { | 
                                                        
| 8834 | 8834 | dir: "ltr",  | 
                                                        
| 8835 | - url: "' . $url . '",  | 
                                                        |
| 8835 | + url: "' . $url.'",  | 
                                                        |
| 8836 | 8836 | dataType: \'json\',  | 
                                                        
| 8837 | 8837 | delay: 250,  | 
                                                        
| 8838 | 8838 |  					    	data: function (params) { | 
                                                        
@@ -8859,9 +8859,9 @@ discard block  | 
                                                    ||
| 8859 | 8859 | },  | 
                                                        
| 8860 | 8860 | language: select2arrayoflanguage,  | 
                                                        
| 8861 | 8861 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */  | 
                                                        
| 8862 | - placeholder: "' . dol_escape_js($placeholder) . '",  | 
                                                        |
| 8862 | + placeholder: "' . dol_escape_js($placeholder).'",  | 
                                                        |
| 8863 | 8863 |  				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work | 
                                                        
| 8864 | - minimumInputLength: ' . ((int) $minimumInputLength) . ',  | 
                                                        |
| 8864 | + minimumInputLength: ' . ((int) $minimumInputLength).',  | 
                                                        |
| 8865 | 8865 |  				        formatResult: function (result, container, query, escapeMarkup) { | 
                                                        
| 8866 | 8866 | return escapeMarkup(result.text);  | 
                                                        
| 8867 | 8867 | },  | 
                                                        
@@ -8869,10 +8869,10 @@ discard block  | 
                                                    ||
| 8869 | 8869 | |
| 8870 | 8870 | ' . ($callurlonselect ? '  | 
                                                        
| 8871 | 8871 | /* Code to execute a GET when we select a value */  | 
                                                        
| 8872 | -	                $(".' . $htmlname . '").change(function() { | 
                                                        |
| 8873 | -				    	var selected = $(".' . $htmlname . '").val(); | 
                                                        |
| 8872 | +	                $(".' . $htmlname.'").change(function() { | 
                                                        |
| 8873 | +				    	var selected = $(".' . $htmlname.'").val(); | 
                                                        |
| 8874 | 8874 |  	                	console.log("We select in selectArrayAjax the entry "+selected) | 
                                                        
| 8875 | -				        $(".' . $htmlname . '").val("");  /* reset visible combo value */ | 
                                                        |
| 8875 | +				        $(".' . $htmlname.'").val("");  /* reset visible combo value */ | 
                                                        |
| 8876 | 8876 |  	    			    $.each( saveRemoteData, function( key, value ) { | 
                                                        
| 8877 | 8877 | if (key == selected)  | 
                                                        
| 8878 | 8878 |  	    			            { | 
                                                        
@@ -8880,7 +8880,7 @@ discard block  | 
                                                    ||
| 8880 | 8880 | location.assign(value.url);  | 
                                                        
| 8881 | 8881 | }  | 
                                                        
| 8882 | 8882 | });  | 
                                                        
| 8883 | - });' : '') . '  | 
                                                        |
| 8883 | + });' : '').'  | 
                                                        |
| 8884 | 8884 | |
| 8885 | 8885 | });  | 
                                                        
| 8886 | 8886 | </script>';  | 
                                                        
@@ -8916,14 +8916,14 @@ discard block  | 
                                                    ||
| 8916 | 8916 | public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')  | 
                                                        
| 8917 | 8917 |  	{ | 
                                                        
| 8918 | 8918 | global $conf, $langs;  | 
                                                        
| 8919 | - global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8919 | + global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8920 | 8920 | |
| 8921 | 8921 | // TODO Use an internal dolibarr component instead of select2  | 
                                                        
| 8922 | 8922 |  		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
| 8923 | 8923 | return '';  | 
                                                        
| 8924 | 8924 | }  | 
                                                        
| 8925 | 8925 | |
| 8926 | - $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';  | 
                                                        |
| 8926 | + $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';  | 
                                                        |
| 8927 | 8927 | |
| 8928 | 8928 | $formattedarrayresult = array();  | 
                                                        
| 8929 | 8929 | |
@@ -8938,20 +8938,20 @@ discard block  | 
                                                    ||
| 8938 | 8938 | $outdelayed = '';  | 
                                                        
| 8939 | 8939 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 8940 | 8940 | $tmpplugin = 'select2';  | 
                                                        
| 8941 | - $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->  | 
                                                        |
| 8942 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 8941 | + $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->  | 
                                                        |
| 8942 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 8943 | 8943 |  				$(document).ready(function () { | 
                                                        
| 8944 | - var data = ' . json_encode($formattedarrayresult) . ';  | 
                                                        |
| 8944 | + var data = ' . json_encode($formattedarrayresult).';  | 
                                                        |
| 8945 | 8945 | |
| 8946 | - ' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '  | 
                                                        |
| 8946 | + ' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'  | 
                                                        |
| 8947 | 8947 | |
| 8948 | -					$(".' . $htmlname . '").select2({ | 
                                                        |
| 8948 | +					$(".' . $htmlname.'").select2({ | 
                                                        |
| 8949 | 8949 | data: data,  | 
                                                        
| 8950 | 8950 | language: select2arrayoflanguage,  | 
                                                        
| 8951 | 8951 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */  | 
                                                        
| 8952 | - placeholder: "' . dol_escape_js($placeholder) . '",  | 
                                                        |
| 8952 | + placeholder: "' . dol_escape_js($placeholder).'",  | 
                                                        |
| 8953 | 8953 |  						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work | 
                                                        
| 8954 | - minimumInputLength: ' . $minimumInputLength . ',  | 
                                                        |
| 8954 | + minimumInputLength: ' . $minimumInputLength.',  | 
                                                        |
| 8955 | 8955 |  						formatResult: function (result, container, query, escapeMarkup) { | 
                                                        
| 8956 | 8956 | return escapeMarkup(result.text);  | 
                                                        
| 8957 | 8957 | },  | 
                                                        
@@ -8990,11 +8990,11 @@ discard block  | 
                                                    ||
| 8990 | 8990 | |
| 8991 | 8991 | ' . ($callurlonselect ? '  | 
                                                        
| 8992 | 8992 | /* Code to execute a GET when we select a value */  | 
                                                        
| 8993 | -					$(".' . $htmlname . '").change(function() { | 
                                                        |
| 8994 | -						var selected = $(".' . $htmlname . '").val(); | 
                                                        |
| 8993 | +					$(".' . $htmlname.'").change(function() { | 
                                                        |
| 8994 | +						var selected = $(".' . $htmlname.'").val(); | 
                                                        |
| 8995 | 8995 |  						console.log("We select "+selected) | 
                                                        
| 8996 | 8996 | |
| 8997 | -						$(".' . $htmlname . '").val("");  /* reset visible combo value */ | 
                                                        |
| 8997 | +						$(".' . $htmlname.'").val("");  /* reset visible combo value */ | 
                                                        |
| 8998 | 8998 |  						$.each( saveRemoteData, function( key, value ) { | 
                                                        
| 8999 | 8999 | if (key == selected)  | 
                                                        
| 9000 | 9000 |  							{ | 
                                                        
@@ -9002,7 +9002,7 @@ discard block  | 
                                                    ||
| 9002 | 9002 | location.assign(value.url);  | 
                                                        
| 9003 | 9003 | }  | 
                                                        
| 9004 | 9004 | });  | 
                                                        
| 9005 | - });' : '') . '  | 
                                                        |
| 9005 | + });' : '').'  | 
                                                        |
| 9006 | 9006 | |
| 9007 | 9007 | });  | 
                                                        
| 9008 | 9008 | </script>';  | 
                                                        
@@ -9051,7 +9051,7 @@ discard block  | 
                                                    ||
| 9051 | 9051 | $useenhancedmultiselect = 0;  | 
                                                        
| 9052 | 9052 |  		if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { | 
                                                        
| 9053 | 9053 |  			if ($addjscombo) { | 
                                                        
| 9054 | - $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.  | 
                                                        |
| 9054 | + $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.  | 
                                                        |
| 9055 | 9055 | }  | 
                                                        
| 9056 | 9056 | }  | 
                                                        
| 9057 | 9057 | |
@@ -9060,7 +9060,7 @@ discard block  | 
                                                    ||
| 9060 | 9060 | // submitted to nothing.  | 
                                                        
| 9061 | 9061 | $out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">';  | 
                                                        
| 9062 | 9062 | // Output select component  | 
                                                        
| 9063 | -		$out .= '<select id="' . $htmlname . '" class="multiselect' . ($useenhancedmultiselect ? ' multiselectononeline' : '') . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', (string) $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n"; | 
                                                        |
| 9063 | +		$out .= '<select id="'.$htmlname.'" class="multiselect'.($useenhancedmultiselect ? ' multiselectononeline' : '').($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', (string) $width) ? $width : $width.'px').'"' : '').'>'."\n"; | 
                                                        |
| 9064 | 9064 |  		if (is_array($array) && !empty($array)) { | 
                                                        
| 9065 | 9065 |  			if ($value_as_key) { | 
                                                        
| 9066 | 9066 | $array = array_combine($array, $array);  | 
                                                        
@@ -9081,33 +9081,33 @@ discard block  | 
                                                    ||
| 9081 | 9081 | $tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml'];  | 
                                                        
| 9082 | 9082 | }  | 
                                                        
| 9083 | 9083 | $newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);  | 
                                                        
| 9084 | - $newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);  | 
                                                        |
| 9084 | + $newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);  | 
                                                        |
| 9085 | 9085 | |
| 9086 | - $out .= '<option value="' . $tmpkey . '"';  | 
                                                        |
| 9086 | + $out .= '<option value="'.$tmpkey.'"';  | 
                                                        |
| 9087 | 9087 |  					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { | 
                                                        
| 9088 | 9088 | $out .= ' selected';  | 
                                                        
| 9089 | 9089 | }  | 
                                                        
| 9090 | 9090 |  					if (!empty($tmplabelhtml)) { | 
                                                        
| 9091 | - $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';  | 
                                                        |
| 9091 | + $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';  | 
                                                        |
| 9092 | 9092 |  					} else { | 
                                                        
| 9093 | -						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; | 
                                                        |
| 9094 | - $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';  | 
                                                        |
| 9093 | +						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; | 
                                                        |
| 9094 | + $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';  | 
                                                        |
| 9095 | 9095 | }  | 
                                                        
| 9096 | 9096 | $out .= '>';  | 
                                                        
| 9097 | 9097 | $out .= dol_htmlentitiesbr($newval);  | 
                                                        
| 9098 | - $out .= '</option>' . "\n";  | 
                                                        |
| 9098 | + $out .= '</option>'."\n";  | 
                                                        |
| 9099 | 9099 | }  | 
                                                        
| 9100 | 9100 | }  | 
                                                        
| 9101 | 9101 | }  | 
                                                        
| 9102 | - $out .= '</select>' . "\n";  | 
                                                        |
| 9102 | + $out .= '</select>'."\n";  | 
                                                        |
| 9103 | 9103 | |
| 9104 | 9104 | // Add code for jquery to use multiselect  | 
                                                        
| 9105 | 9105 |  		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
| 9106 | - $out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';  | 
                                                        |
| 9107 | - $out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";  | 
                                                        |
| 9106 | + $out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';  | 
                                                        |
| 9107 | + $out .= "\n".'<script nonce="'.getNonce().'">'."\n";  | 
                                                        |
| 9108 | 9108 |  			if ($addjscombo == 1) { | 
                                                        
| 9109 | 9109 |  				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; | 
                                                        
| 9110 | -				$out .= 'function formatResult(record, container) {' . "\n"; | 
                                                        |
| 9110 | +				$out .= 'function formatResult(record, container) {'."\n"; | 
                                                        |
| 9111 | 9111 | // If property data-html set, we decode html entities and use this.  | 
                                                        
| 9112 | 9112 | // Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.  | 
                                                        
| 9113 | 9113 |  				$out .= '	if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {'; | 
                                                        
@@ -9115,26 +9115,26 @@ discard block  | 
                                                    ||
| 9115 | 9115 |  				$out .= '		return htmlEntityDecodeJs($(record.element).attr("data-html"));'; | 
                                                        
| 9116 | 9116 | $out .= ' }'."\n";  | 
                                                        
| 9117 | 9117 | $out .= ' return record.text;';  | 
                                                        
| 9118 | - $out .= '}' . "\n";  | 
                                                        |
| 9119 | -				$out .= 'function formatSelection(record) {' . "\n"; | 
                                                        |
| 9118 | + $out .= '}'."\n";  | 
                                                        |
| 9119 | +				$out .= 'function formatSelection(record) {'."\n"; | 
                                                        |
| 9120 | 9120 |  				if ($elemtype == 'category') { | 
                                                        
| 9121 | - $out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';  | 
                                                        |
| 9121 | + $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';  | 
                                                        |
| 9122 | 9122 |  				} else { | 
                                                        
| 9123 | 9123 | $out .= 'return record.text;';  | 
                                                        
| 9124 | 9124 | }  | 
                                                        
| 9125 | - $out .= '}' . "\n";  | 
                                                        |
| 9125 | + $out .= '}'."\n";  | 
                                                        |
| 9126 | 9126 |  				$out .= '$(document).ready(function () { | 
                                                        
| 9127 | -							$(\'#' . $htmlname . '\').' . $tmpplugin . '({'; | 
                                                        |
| 9127 | +							$(\'#' . $htmlname.'\').'.$tmpplugin.'({'; | 
                                                        |
| 9128 | 9128 |  				if ($placeholder) { | 
                                                        
| 9129 | 9129 | $out .= '  | 
                                                        
| 9130 | 9130 |  								placeholder: { | 
                                                        
| 9131 | 9131 | id: \'-1\',  | 
                                                        
| 9132 | - text: \'' . dol_escape_js($placeholder) . '\'  | 
                                                        |
| 9132 | + text: \'' . dol_escape_js($placeholder).'\'  | 
                                                        |
| 9133 | 9133 | },';  | 
                                                        
| 9134 | 9134 | }  | 
                                                        
| 9135 | 9135 | $out .= ' dir: \'ltr\',  | 
                                                        
| 9136 | 9136 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */  | 
                                                        
| 9137 | - dropdownCssClass: \'' . $morecss . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */  | 
                                                        |
| 9137 | + dropdownCssClass: \'' . $morecss.'\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */  | 
                                                        |
| 9138 | 9138 | // Specify format function for dropdown item  | 
                                                        
| 9139 | 9139 | formatResult: formatResult,  | 
                                                        
| 9140 | 9140 | templateResult: formatResult, /* For 4.0 */  | 
                                                        
@@ -9146,21 +9146,21 @@ discard block  | 
                                                    ||
| 9146 | 9146 | |
| 9147 | 9147 | /* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set  | 
                                                        
| 9148 | 9148 | the size only if component is not hidden by default on load */  | 
                                                        
| 9149 | - $(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');  | 
                                                        |
| 9149 | + $(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\');  | 
                                                        |
| 9150 | 9150 | });' . "\n";  | 
                                                        
| 9151 | 9151 |  			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { | 
                                                        
| 9152 | 9152 | // Add other js lib  | 
                                                        
| 9153 | 9153 | // TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin  | 
                                                        
| 9154 | 9154 | // ...  | 
                                                        
| 9155 | - $out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';  | 
                                                        |
| 9155 | + $out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');';  | 
                                                        |
| 9156 | 9156 |  				$out .= '$(document).ready(function () { | 
                                                        
| 9157 | -							$(\'#' . $htmlname . '\').multiSelect({ | 
                                                        |
| 9157 | +							$(\'#' . $htmlname.'\').multiSelect({ | 
                                                        |
| 9158 | 9158 | containerHTML: \'<div class="multi-select-container">\',  | 
                                                        
| 9159 | 9159 | menuHTML: \'<div class="multi-select-menu">\',  | 
                                                        
| 9160 | - buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',  | 
                                                        |
| 9160 | + buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',  | 
                                                        |
| 9161 | 9161 | menuItemHTML: \'<label class="multi-select-menuitem">\',  | 
                                                        
| 9162 | 9162 | activeClass: \'multi-select-container--open\',  | 
                                                        
| 9163 | - noneText: \'' . $placeholder . '\'  | 
                                                        |
| 9163 | + noneText: \'' . $placeholder.'\'  | 
                                                        |
| 9164 | 9164 | });  | 
                                                        
| 9165 | 9165 | })';  | 
                                                        
| 9166 | 9166 | }  | 
                                                        
@@ -9193,7 +9193,7 @@ discard block  | 
                                                    ||
| 9193 | 9193 | return '';  | 
                                                        
| 9194 | 9194 | }  | 
                                                        
| 9195 | 9195 | |
| 9196 | - $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show  | 
                                                        |
| 9196 | + $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show  | 
                                                        |
| 9197 | 9197 | |
| 9198 | 9198 |  		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user | 
                                                        
| 9199 | 9199 |  			$tmparray = explode(',', $user->conf->$tmpvar); | 
                                                        
@@ -9236,19 +9236,19 @@ discard block  | 
                                                    ||
| 9236 | 9236 | }  | 
                                                        
| 9237 | 9237 | |
| 9238 | 9238 | // Note: $val['checked'] <> 0 means we must show the field into the combo list @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset  | 
                                                        
| 9239 | -				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>'; | 
                                                        |
| 9240 | - $listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');  | 
                                                        |
| 9239 | +				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>'; | 
                                                        |
| 9240 | + $listcheckedstring .= (empty($val['checked']) ? '' : $key.',');  | 
                                                        |
| 9241 | 9241 | }  | 
                                                        
| 9242 | 9242 | }  | 
                                                        
| 9243 | 9243 | |
| 9244 | - $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->  | 
                                                        |
| 9244 | + $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->  | 
                                                        |
| 9245 | 9245 | |
| 9246 | 9246 | <dl class="dropdown">  | 
                                                        
| 9247 | 9247 | <dt>  | 
                                                        
| 9248 | - <a href="#' . $htmlname . '">  | 
                                                        |
| 9249 | -              ' . img_picto('', 'list') . ' | 
                                                        |
| 9248 | + <a href="#' . $htmlname.'">  | 
                                                        |
| 9249 | +              ' . img_picto('', 'list').' | 
                                                        |
| 9250 | 9250 | </a>  | 
                                                        
| 9251 | - <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">  | 
                                                        |
| 9251 | + <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">  | 
                                                        |
| 9252 | 9252 | </dt>  | 
                                                        
| 9253 | 9253 | <dd class="dropdowndd">  | 
                                                        
| 9254 | 9254 | <div class="multiselectcheckbox'.$htmlname.'">  | 
                                                        
@@ -9260,19 +9260,19 @@ discard block  | 
                                                    ||
| 9260 | 9260 | </dd>  | 
                                                        
| 9261 | 9261 | </dl>  | 
                                                        
| 9262 | 9262 | |
| 9263 | - <script nonce="' . getNonce() . '" type="text/javascript">  | 
                                                        |
| 9263 | + <script nonce="' . getNonce().'" type="text/javascript">  | 
                                                        |
| 9264 | 9264 |            jQuery(document).ready(function () { | 
                                                        
| 9265 | -              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { | 
                                                        |
| 9265 | +              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { | 
                                                        |
| 9266 | 9266 |                    console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); | 
                                                        
| 9267 | 9267 | |
| 9268 | 9268 |                    $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST | 
                                                        
| 9269 | 9269 | |
| 9270 | 9270 | var title = $(this).val() + ",";  | 
                                                        
| 9271 | 9271 |                    if ($(this).is(\':checked\')) { | 
                                                        
| 9272 | - $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());  | 
                                                        |
| 9272 | + $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());  | 
                                                        |
| 9273 | 9273 | }  | 
                                                        
| 9274 | 9274 |                    else { | 
                                                        
| 9275 | - $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )  | 
                                                        |
| 9275 | + $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )  | 
                                                        |
| 9276 | 9276 | }  | 
                                                        
| 9277 | 9277 | // Now, we submit page  | 
                                                        
| 9278 | 9278 | //$(this).parents(\'form:first\').submit();  | 
                                                        
@@ -9303,7 +9303,7 @@ discard block  | 
                                                    ||
| 9303 | 9303 | */  | 
                                                        
| 9304 | 9304 | public function showCategories($id, $type, $rendermode = 0, $nolink = 0)  | 
                                                        
| 9305 | 9305 |  	{ | 
                                                        
| 9306 | - include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';  | 
                                                        |
| 9306 | + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';  | 
                                                        |
| 9307 | 9307 | |
| 9308 | 9308 | $cat = new Categorie($this->db);  | 
                                                        
| 9309 | 9309 | $categories = $cat->containing($id, $type);  | 
                                                        
@@ -9313,13 +9313,13 @@ discard block  | 
                                                    ||
| 9313 | 9313 |  			foreach ($categories as $c) { | 
                                                        
| 9314 | 9314 |  				$ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text | 
                                                        
| 9315 | 9315 |  				foreach ($ways as $way) { | 
                                                        
| 9316 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';  | 
                                                        |
| 9316 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';  | 
                                                        |
| 9317 | 9317 | }  | 
                                                        
| 9318 | 9318 | }  | 
                                                        
| 9319 | 9319 |  			if (empty($toprint)) { | 
                                                        
| 9320 | 9320 | return '';  | 
                                                        
| 9321 | 9321 |  			} else { | 
                                                        
| 9322 | -				return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; | 
                                                        |
| 9322 | +				return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; | 
                                                        |
| 9323 | 9323 | }  | 
                                                        
| 9324 | 9324 | }  | 
                                                        
| 9325 | 9325 | |
@@ -9368,15 +9368,15 @@ discard block  | 
                                                    ||
| 9368 | 9368 | |
| 9369 | 9369 | |
| 9370 | 9370 | print '<div class="div-table-responsive-no-min">';  | 
                                                        
| 9371 | - print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '" data-elementid="' . $object->id . '" >';  | 
                                                        |
| 9371 | + print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >';  | 
                                                        |
| 9372 | 9372 | |
| 9373 | 9373 | print '<tr class="liste_titre">';  | 
                                                        
| 9374 | -			print '<td>' . $langs->trans("Type") . '</td>'; | 
                                                        |
| 9375 | -			print '<td>' . $langs->trans("Ref") . '</td>'; | 
                                                        |
| 9374 | +			print '<td>'.$langs->trans("Type").'</td>'; | 
                                                        |
| 9375 | +			print '<td>'.$langs->trans("Ref").'</td>'; | 
                                                        |
| 9376 | 9376 | print '<td class="center"></td>';  | 
                                                        
| 9377 | -			print '<td class="center">' . $langs->trans("Date") . '</td>'; | 
                                                        |
| 9378 | -			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; | 
                                                        |
| 9379 | -			print '<td class="right">' . $langs->trans("Status") . '</td>'; | 
                                                        |
| 9377 | +			print '<td class="center">'.$langs->trans("Date").'</td>'; | 
                                                        |
| 9378 | +			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; | 
                                                        |
| 9379 | +			print '<td class="right">'.$langs->trans("Status").'</td>'; | 
                                                        |
| 9380 | 9380 | print '<td></td>';  | 
                                                        
| 9381 | 9381 | print '</tr>';  | 
                                                        
| 9382 | 9382 | |
@@ -9395,13 +9395,13 @@ discard block  | 
                                                    ||
| 9395 | 9395 |  				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { | 
                                                        
| 9396 | 9396 | $element = $regs[1];  | 
                                                        
| 9397 | 9397 | $subelement = $regs[2];  | 
                                                        
| 9398 | - $tplpath = $element . '/' . $subelement;  | 
                                                        |
| 9398 | + $tplpath = $element.'/'.$subelement;  | 
                                                        |
| 9399 | 9399 | }  | 
                                                        
| 9400 | 9400 | $tplname = 'linkedobjectblock';  | 
                                                        
| 9401 | 9401 | |
| 9402 | 9402 | // To work with non standard path  | 
                                                        
| 9403 | 9403 |  				if ($objecttype == 'facture') { | 
                                                        
| 9404 | - $tplpath = 'compta/' . $element;  | 
                                                        |
| 9404 | + $tplpath = 'compta/'.$element;  | 
                                                        |
| 9405 | 9405 |  					if (!isModEnabled('invoice')) { | 
                                                        
| 9406 | 9406 | continue; // Do not show if module disabled  | 
                                                        
| 9407 | 9407 | }  | 
                                                        
@@ -9412,7 +9412,7 @@ discard block  | 
                                                    ||
| 9412 | 9412 | continue; // Do not show if module disabled  | 
                                                        
| 9413 | 9413 | }  | 
                                                        
| 9414 | 9414 |  				} elseif ($objecttype == 'propal') { | 
                                                        
| 9415 | - $tplpath = 'comm/' . $element;  | 
                                                        |
| 9415 | + $tplpath = 'comm/'.$element;  | 
                                                        |
| 9416 | 9416 |  					if (!isModEnabled('propal')) { | 
                                                        
| 9417 | 9417 | continue; // Do not show if module disabled  | 
                                                        
| 9418 | 9418 | }  | 
                                                        
@@ -9465,7 +9465,7 @@ discard block  | 
                                                    ||
| 9465 | 9465 | $linkedObjectBlock = $objects;  | 
                                                        
| 9466 | 9466 | |
| 9467 | 9467 | // Output template part (modules that overwrite templates must declare this into descriptor)  | 
                                                        
| 9468 | -				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); | 
                                                        |
| 9468 | +				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); | 
                                                        |
| 9469 | 9469 |  				foreach ($dirtpls as $reldir) { | 
                                                        
| 9470 | 9470 | $reldir = rtrim($reldir, '/');  | 
                                                        
| 9471 | 9471 |  					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after | 
                                                        
@@ -9473,7 +9473,7 @@ discard block  | 
                                                    ||
| 9473 | 9473 | $noMoreLinkedObjectBlockAfter = 1;  | 
                                                        
| 9474 | 9474 | }  | 
                                                        
| 9475 | 9475 | |
| 9476 | - $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');  | 
                                                        |
| 9476 | + $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');  | 
                                                        |
| 9477 | 9477 |  					if ($res) { | 
                                                        
| 9478 | 9478 | $nboftypesoutput++;  | 
                                                        
| 9479 | 9479 | break;  | 
                                                        
@@ -9482,7 +9482,7 @@ discard block  | 
                                                    ||
| 9482 | 9482 | }  | 
                                                        
| 9483 | 9483 | |
| 9484 | 9484 |  			if (!$nboftypesoutput) { | 
                                                        
| 9485 | -				print '<tr><td colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; | 
                                                        |
| 9485 | +				print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; | 
                                                        |
| 9486 | 9486 | }  | 
                                                        
| 9487 | 9487 | |
| 9488 | 9488 | print '</table>';  | 
                                                        
@@ -9522,14 +9522,14 @@ discard block  | 
                                                    ||
| 9522 | 9522 |  		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { | 
                                                        
| 9523 | 9523 | $listofidcompanytoscan = $object->thirdparty->id;  | 
                                                        
| 9524 | 9524 |  			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { | 
                                                        
| 9525 | - $listofidcompanytoscan .= ',' . $object->thirdparty->parent;  | 
                                                        |
| 9525 | + $listofidcompanytoscan .= ','.$object->thirdparty->parent;  | 
                                                        |
| 9526 | 9526 | }  | 
                                                        
| 9527 | 9527 |  			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { | 
                                                        
| 9528 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 9528 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 9529 | 9529 | $tmpproject = new Project($this->db);  | 
                                                        
| 9530 | 9530 | $tmpproject->fetch($object->fk_project);  | 
                                                        
| 9531 | 9531 |  				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { | 
                                                        
| 9532 | - $listofidcompanytoscan .= ',' . $tmpproject->socid;  | 
                                                        |
| 9532 | + $listofidcompanytoscan .= ','.$tmpproject->socid;  | 
                                                        |
| 9533 | 9533 | }  | 
                                                        
| 9534 | 9534 | unset($tmpproject);  | 
                                                        
| 9535 | 9535 | }  | 
                                                        
@@ -9539,63 +9539,63 @@ discard block  | 
                                                    ||
| 9539 | 9539 |  					'enabled' => isModEnabled('propal'), | 
                                                        
| 9540 | 9540 | 'perms' => 1,  | 
                                                        
| 9541 | 9541 | 'label' => 'LinkToProposal',  | 
                                                        
| 9542 | -					'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') . ')'), | 
                                                        |
| 9542 | +					'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').')'), | 
                                                        |
| 9543 | 9543 | 'shipping' => array(  | 
                                                        
| 9544 | 9544 |  					'enabled' => isModEnabled('shipping'), | 
                                                        
| 9545 | 9545 | 'perms' => 1,  | 
                                                        
| 9546 | 9546 | 'label' => 'LinkToExpedition',  | 
                                                        
| 9547 | -					'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') . ')'), | 
                                                        |
| 9547 | +					'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').')'), | 
                                                        |
| 9548 | 9548 | 'order' => array(  | 
                                                        
| 9549 | 9549 |  					'enabled' => isModEnabled('order'), | 
                                                        
| 9550 | 9550 | 'perms' => 1,  | 
                                                        
| 9551 | 9551 | 'label' => 'LinkToOrder',  | 
                                                        
| 9552 | -					'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') . ')'), | 
                                                        |
| 9552 | +					'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').')'), | 
                                                        |
| 9553 | 9553 | 'invoice' => array(  | 
                                                        
| 9554 | 9554 |  					'enabled' => isModEnabled('invoice'), | 
                                                        
| 9555 | 9555 | 'perms' => 1,  | 
                                                        
| 9556 | 9556 | 'label' => 'LinkToInvoice',  | 
                                                        
| 9557 | -					'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') . ')'), | 
                                                        |
| 9557 | +					'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').')'), | 
                                                        |
| 9558 | 9558 | 'invoice_template' => array(  | 
                                                        
| 9559 | 9559 |  					'enabled' => isModEnabled('invoice'), | 
                                                        
| 9560 | 9560 | 'perms' => 1,  | 
                                                        
| 9561 | 9561 | 'label' => 'LinkToTemplateInvoice',  | 
                                                        
| 9562 | -					'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') . ')'), | 
                                                        |
| 9562 | +					'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').')'), | 
                                                        |
| 9563 | 9563 | 'contrat' => array(  | 
                                                        
| 9564 | 9564 |  					'enabled' => isModEnabled('contract'), | 
                                                        
| 9565 | 9565 | 'perms' => 1,  | 
                                                        
| 9566 | 9566 | 'label' => 'LinkToContract',  | 
                                                        
| 9567 | 9567 | '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  | 
                                                        
| 9568 | -							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' | 
                                                        |
| 9568 | +							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' | 
                                                        |
| 9569 | 9569 | ),  | 
                                                        
| 9570 | 9570 | 'fichinter' => array(  | 
                                                        
| 9571 | 9571 |  					'enabled' => isModEnabled('intervention'), | 
                                                        
| 9572 | 9572 | 'perms' => 1,  | 
                                                        
| 9573 | 9573 | 'label' => 'LinkToIntervention',  | 
                                                        
| 9574 | -					'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') . ')'), | 
                                                        |
| 9574 | +					'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').')'), | 
                                                        |
| 9575 | 9575 | 'supplier_proposal' => array(  | 
                                                        
| 9576 | 9576 |  					'enabled' => isModEnabled('supplier_proposal'), | 
                                                        
| 9577 | 9577 | 'perms' => 1,  | 
                                                        
| 9578 | 9578 | 'label' => 'LinkToSupplierProposal',  | 
                                                        
| 9579 | -					'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') . ')'), | 
                                                        |
| 9579 | +					'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').')'), | 
                                                        |
| 9580 | 9580 | 'order_supplier' => array(  | 
                                                        
| 9581 | 9581 |  					'enabled' => isModEnabled("supplier_order"), | 
                                                        
| 9582 | 9582 | 'perms' => 1,  | 
                                                        
| 9583 | 9583 | 'label' => 'LinkToSupplierOrder',  | 
                                                        
| 9584 | -					'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') . ')'), | 
                                                        |
| 9584 | +					'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').')'), | 
                                                        |
| 9585 | 9585 | 'invoice_supplier' => array(  | 
                                                        
| 9586 | 9586 |  					'enabled' => isModEnabled("supplier_invoice"), | 
                                                        
| 9587 | 9587 | 'perms' => 1, 'label' => 'LinkToSupplierInvoice',  | 
                                                        
| 9588 | -					'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') . ')'), | 
                                                        |
| 9588 | +					'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').')'), | 
                                                        |
| 9589 | 9589 | 'ticket' => array(  | 
                                                        
| 9590 | 9590 |  					'enabled' => isModEnabled('ticket'), | 
                                                        
| 9591 | 9591 | 'perms' => 1,  | 
                                                        
| 9592 | 9592 | 'label' => 'LinkToTicket',  | 
                                                        
| 9593 | -					'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') . ')'), | 
                                                        |
| 9593 | +					'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').')'), | 
                                                        |
| 9594 | 9594 | 'mo' => array(  | 
                                                        
| 9595 | 9595 |  					'enabled' => isModEnabled('mrp'), | 
                                                        
| 9596 | 9596 | 'perms' => 1,  | 
                                                        
| 9597 | 9597 | 'label' => 'LinkToMo',  | 
                                                        
| 9598 | -					'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') . ')') | 
                                                        |
| 9598 | +					'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').')') | 
                                                        |
| 9599 | 9599 | );  | 
                                                        
| 9600 | 9600 | }  | 
                                                        
| 9601 | 9601 | |
@@ -9631,22 +9631,22 @@ discard block  | 
                                                    ||
| 9631 | 9631 | }  | 
                                                        
| 9632 | 9632 | |
| 9633 | 9633 |  			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { | 
                                                        
| 9634 | - print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';  | 
                                                        |
| 9634 | + print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';  | 
                                                        |
| 9635 | 9635 | |
| 9636 | 9636 |  				if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { | 
                                                        
| 9637 | 9637 | print '<br>'."\n";  | 
                                                        
| 9638 | 9638 | print '<!-- form to add a link from anywhere -->'."\n";  | 
                                                        
| 9639 | - print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';  | 
                                                        |
| 9640 | - print '<input type="hidden" name="id" value="' . $object->id . '">';  | 
                                                        |
| 9639 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';  | 
                                                        |
| 9640 | + print '<input type="hidden" name="id" value="'.$object->id.'">';  | 
                                                        |
| 9641 | 9641 | print '<input type="hidden" name="action" value="addlinkbyref">';  | 
                                                        
| 9642 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 9643 | - print '<input type="hidden" name="addlink" value="' . $key . '">';  | 
                                                        |
| 9642 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 9643 | + print '<input type="hidden" name="addlink" value="'.$key.'">';  | 
                                                        |
| 9644 | 9644 | print '<table class="noborder">';  | 
                                                        
| 9645 | 9645 | print '<tr>';  | 
                                                        
| 9646 | 9646 |  					//print '<td>' . $langs->trans("Ref") . '</td>'; | 
                                                        
| 9647 | -					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; | 
                                                        |
| 9648 | -					print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '"> '; | 
                                                        |
| 9649 | -					print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; | 
                                                        |
| 9647 | +					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; | 
                                                        |
| 9648 | +					print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'"> '; | 
                                                        |
| 9649 | +					print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; | 
                                                        |
| 9650 | 9650 | print '</tr>';  | 
                                                        
| 9651 | 9651 | print '</table>';  | 
                                                        
| 9652 | 9652 | print '</form>';  | 
                                                        
@@ -9661,48 +9661,48 @@ discard block  | 
                                                    ||
| 9661 | 9661 | |
| 9662 | 9662 | print '<br>';  | 
                                                        
| 9663 | 9663 | print '<!-- form to add a link from object to same thirdparty -->'."\n";  | 
                                                        
| 9664 | - print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';  | 
                                                        |
| 9664 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';  | 
                                                        |
| 9665 | 9665 | print '<input type="hidden" name="action" value="addlink">';  | 
                                                        
| 9666 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 9667 | - print '<input type="hidden" name="id" value="' . $object->id . '">';  | 
                                                        |
| 9668 | - print '<input type="hidden" name="addlink" value="' . $key . '">';  | 
                                                        |
| 9666 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 9667 | + print '<input type="hidden" name="id" value="'.$object->id.'">';  | 
                                                        |
| 9668 | + print '<input type="hidden" name="addlink" value="'.$key.'">';  | 
                                                        |
| 9669 | 9669 | print '<table class="noborder">';  | 
                                                        
| 9670 | 9670 | print '<tr class="liste_titre">';  | 
                                                        
| 9671 | 9671 | print '<td class="nowrap"></td>';  | 
                                                        
| 9672 | -					print '<td class="center">' . $langs->trans("Ref") . '</td>'; | 
                                                        |
| 9673 | -					print '<td class="left">' . $langs->trans("RefCustomer") . '</td>'; | 
                                                        |
| 9674 | -					print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; | 
                                                        |
| 9675 | -					print '<td class="left">' . $langs->trans("Company") . '</td>'; | 
                                                        |
| 9672 | +					print '<td class="center">'.$langs->trans("Ref").'</td>'; | 
                                                        |
| 9673 | +					print '<td class="left">'.$langs->trans("RefCustomer").'</td>'; | 
                                                        |
| 9674 | +					print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; | 
                                                        |
| 9675 | +					print '<td class="left">'.$langs->trans("Company").'</td>'; | 
                                                        |
| 9676 | 9676 | print '</tr>';  | 
                                                        
| 9677 | 9677 |  					while ($i < $num) { | 
                                                        
| 9678 | 9678 | $objp = $this->db->fetch_object($resqllist);  | 
                                                        
| 9679 | 9679 | |
| 9680 | 9680 | print '<tr class="oddeven">';  | 
                                                        
| 9681 | 9681 | print '<td class="left">';  | 
                                                        
| 9682 | - print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">';  | 
                                                        |
| 9682 | + print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';  | 
                                                        |
| 9683 | 9683 | print '</td>';  | 
                                                        
| 9684 | - print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>';  | 
                                                        |
| 9685 | - print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>';  | 
                                                        |
| 9684 | + print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';  | 
                                                        |
| 9685 | + print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>';  | 
                                                        |
| 9686 | 9686 | print '<td class="right">';  | 
                                                        
| 9687 | 9687 |  						if ($possiblelink['label'] == 'LinkToContract') { | 
                                                        
| 9688 | 9688 | $form = new Form($this->db);  | 
                                                        
| 9689 | -							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; | 
                                                        |
| 9689 | +							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; | 
                                                        |
| 9690 | 9690 | }  | 
                                                        
| 9691 | - print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>';  | 
                                                        |
| 9691 | + print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';  | 
                                                        |
| 9692 | 9692 | print '</td>';  | 
                                                        
| 9693 | - print '<td>' . $objp->name . '</td>';  | 
                                                        |
| 9693 | + print '<td>'.$objp->name.'</td>';  | 
                                                        |
| 9694 | 9694 | print '</tr>';  | 
                                                        
| 9695 | 9695 | $i++;  | 
                                                        
| 9696 | 9696 | }  | 
                                                        
| 9697 | 9697 | print '</table>';  | 
                                                        
| 9698 | 9698 | print '<div class="center">';  | 
                                                        
| 9699 | 9699 |  					if ($num) { | 
                                                        
| 9700 | -						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">'; | 
                                                        |
| 9700 | +						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">'; | 
                                                        |
| 9701 | 9701 | }  | 
                                                        
| 9702 | 9702 |  					if (empty($conf->use_javascript_ajax)) { | 
                                                        
| 9703 | -						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; | 
                                                        |
| 9703 | +						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; | 
                                                        |
| 9704 | 9704 |  					} else { | 
                                                        
| 9705 | -						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>'; | 
                                                        |
| 9705 | +						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>'; | 
                                                        |
| 9706 | 9706 | }  | 
                                                        
| 9707 | 9707 | print '</form>';  | 
                                                        
| 9708 | 9708 | $this->db->free($resqllist);  | 
                                                        
@@ -9713,10 +9713,10 @@ discard block  | 
                                                    ||
| 9713 | 9713 | |
| 9714 | 9714 | //$linktoelem.=($linktoelem?'   ':'');  | 
                                                        
| 9715 | 9715 |  				if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { | 
                                                        
| 9716 | -					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; | 
                                                        |
| 9716 | +					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; | 
                                                        |
| 9717 | 9717 | // } else $linktoelem.=$langs->trans($possiblelink['label']);  | 
                                                        
| 9718 | 9718 |  				} else { | 
                                                        
| 9719 | - $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';  | 
                                                        |
| 9719 | + $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';  | 
                                                        |
| 9720 | 9720 | }  | 
                                                        
| 9721 | 9721 | }  | 
                                                        
| 9722 | 9722 | }  | 
                                                        
@@ -9726,11 +9726,11 @@ discard block  | 
                                                    ||
| 9726 | 9726 | <dl class="dropdown" id="linktoobjectname">  | 
                                                        
| 9727 | 9727 | ';  | 
                                                        
| 9728 | 9728 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 9729 | -				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; | 
                                                        |
| 9729 | +				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; | 
                                                        |
| 9730 | 9730 | }  | 
                                                        
| 9731 | 9731 | $linktoelem .= '<dd>  | 
                                                        
| 9732 | 9732 | <div class="multiselectlinkto">  | 
                                                        
| 9733 | - <ul class="ulselectedfields">' . $linktoelemlist . '  | 
                                                        |
| 9733 | + <ul class="ulselectedfields">' . $linktoelemlist.'  | 
                                                        |
| 9734 | 9734 | </ul>  | 
                                                        
| 9735 | 9735 | </div>  | 
                                                        
| 9736 | 9736 | </dd>  | 
                                                        
@@ -9741,7 +9741,7 @@ discard block  | 
                                                    ||
| 9741 | 9741 | |
| 9742 | 9742 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 9743 | 9743 | print '<!-- Add js to show linkto box -->  | 
                                                        
| 9744 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 9744 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 9745 | 9745 |  				jQuery(document).ready(function() { | 
                                                        
| 9746 | 9746 |  					jQuery(".linkto").click(function() { | 
                                                        
| 9747 | 9747 |  						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); | 
                                                        
@@ -9782,19 +9782,19 @@ discard block  | 
                                                    ||
| 9782 | 9782 | |
| 9783 | 9783 | $disabled = ($disabled ? ' disabled' : '');  | 
                                                        
| 9784 | 9784 | |
| 9785 | - $resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";  | 
                                                        |
| 9785 | + $resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";  | 
                                                        |
| 9786 | 9786 |  		if ($useempty) { | 
                                                        
| 9787 | - $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n";  | 
                                                        |
| 9787 | + $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n";  | 
                                                        |
| 9788 | 9788 | }  | 
                                                        
| 9789 | 9789 |  		if (("$value" == 'yes') || ($value == 1)) { | 
                                                        
| 9790 | - $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n";  | 
                                                        |
| 9791 | - $resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n";  | 
                                                        |
| 9790 | + $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";  | 
                                                        |
| 9791 | + $resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";  | 
                                                        |
| 9792 | 9792 |  		} else { | 
                                                        
| 9793 | 9793 | $selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');  | 
                                                        
| 9794 | - $resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n";  | 
                                                        |
| 9795 | - $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n";  | 
                                                        |
| 9794 | + $resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";  | 
                                                        |
| 9795 | + $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";  | 
                                                        |
| 9796 | 9796 | }  | 
                                                        
| 9797 | - $resultyesno .= '</select>' . "\n";  | 
                                                        |
| 9797 | + $resultyesno .= '</select>'."\n";  | 
                                                        |
| 9798 | 9798 | |
| 9799 | 9799 |  		if ($addjscombo) { | 
                                                        
| 9800 | 9800 | $resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);  | 
                                                        
@@ -9818,12 +9818,12 @@ discard block  | 
                                                    ||
| 9818 | 9818 |  	{ | 
                                                        
| 9819 | 9819 | // phpcs:enable  | 
                                                        
| 9820 | 9820 | $sql = "SELECT rowid, label";  | 
                                                        
| 9821 | - $sql .= " FROM " . $this->db->prefix() . "export_model";  | 
                                                        |
| 9822 | - $sql .= " WHERE type = '" . $this->db->escape($type) . "'";  | 
                                                        |
| 9821 | + $sql .= " FROM ".$this->db->prefix()."export_model";  | 
                                                        |
| 9822 | + $sql .= " WHERE type = '".$this->db->escape($type)."'";  | 
                                                        |
| 9823 | 9823 | $sql .= " ORDER BY rowid";  | 
                                                        
| 9824 | 9824 | $result = $this->db->query($sql);  | 
                                                        
| 9825 | 9825 |  		if ($result) { | 
                                                        
| 9826 | - print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 9826 | + print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 9827 | 9827 |  			if ($useempty) { | 
                                                        
| 9828 | 9828 | print '<option value="-1"> </option>';  | 
                                                        
| 9829 | 9829 | }  | 
                                                        
@@ -9833,9 +9833,9 @@ discard block  | 
                                                    ||
| 9833 | 9833 |  			while ($i < $num) { | 
                                                        
| 9834 | 9834 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 9835 | 9835 |  				if ($selected == $obj->rowid) { | 
                                                        
| 9836 | - print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        |
| 9836 | + print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        |
| 9837 | 9837 |  				} else { | 
                                                        
| 9838 | - print '<option value="' . $obj->rowid . '">';  | 
                                                        |
| 9838 | + print '<option value="'.$obj->rowid.'">';  | 
                                                        |
| 9839 | 9839 | }  | 
                                                        
| 9840 | 9840 | print $obj->label;  | 
                                                        
| 9841 | 9841 | print '</option>';  | 
                                                        
@@ -9926,8 +9926,8 @@ discard block  | 
                                                    ||
| 9926 | 9926 | $stringforfirstkey .= ' CTL +';  | 
                                                        
| 9927 | 9927 | }  | 
                                                        
| 9928 | 9928 | |
| 9929 | -			$previous_ref = $object->ref_previous ? '<a accesskey="p" alt="'.dol_escape_htmltag($langs->trans("Previous")).'" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>'; | 
                                                        |
| 9930 | -			$next_ref = $object->ref_next ? '<a accesskey="n" alt="'.dol_escape_htmltag($langs->trans("Next")).'" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>'; | 
                                                        |
| 9929 | +			$previous_ref = $object->ref_previous ? '<a accesskey="p" alt="'.dol_escape_htmltag($langs->trans("Previous")).'" title="'.$stringforfirstkey.' p" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>'; | 
                                                        |
| 9930 | +			$next_ref = $object->ref_next ? '<a accesskey="n" alt="'.dol_escape_htmltag($langs->trans("Next")).'" title="'.$stringforfirstkey.' n" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>'; | 
                                                        |
| 9931 | 9931 | }  | 
                                                        
| 9932 | 9932 | |
| 9933 | 9933 | //print "xx".$previous_ref."x".$next_ref;  | 
                                                        
@@ -9935,18 +9935,18 @@ discard block  | 
                                                    ||
| 9935 | 9935 | |
| 9936 | 9936 | // Right part of banner  | 
                                                        
| 9937 | 9937 |  		if ($morehtmlright) { | 
                                                        
| 9938 | - $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';  | 
                                                        |
| 9938 | + $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';  | 
                                                        |
| 9939 | 9939 | }  | 
                                                        
| 9940 | 9940 | |
| 9941 | 9941 |  		if ($previous_ref || $next_ref || $morehtml) { | 
                                                        
| 9942 | 9942 | $ret .= '<div class="pagination paginationref"><ul class="right">';  | 
                                                        
| 9943 | 9943 | }  | 
                                                        
| 9944 | 9944 |  		if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { | 
                                                        
| 9945 | - $ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';  | 
                                                        |
| 9945 | + $ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';  | 
                                                        |
| 9946 | 9946 | }  | 
                                                        
| 9947 | 9947 |  		if ($shownav && ($previous_ref || $next_ref)) { | 
                                                        
| 9948 | - $ret .= '<li class="pagination">' . $previous_ref . '</li>';  | 
                                                        |
| 9949 | - $ret .= '<li class="pagination">' . $next_ref . '</li>';  | 
                                                        |
| 9948 | + $ret .= '<li class="pagination">'.$previous_ref.'</li>';  | 
                                                        |
| 9949 | + $ret .= '<li class="pagination">'.$next_ref.'</li>';  | 
                                                        |
| 9950 | 9950 | }  | 
                                                        
| 9951 | 9951 |  		if ($previous_ref || $next_ref || $morehtml) { | 
                                                        
| 9952 | 9952 | $ret .= '</ul></div>';  | 
                                                        
@@ -9961,7 +9961,7 @@ discard block  | 
                                                    ||
| 9961 | 9961 | $morehtmlstatus = $hookmanager->resPrint;  | 
                                                        
| 9962 | 9962 | }  | 
                                                        
| 9963 | 9963 |  		if ($morehtmlstatus) { | 
                                                        
| 9964 | - $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';  | 
                                                        |
| 9964 | + $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';  | 
                                                        |
| 9965 | 9965 | }  | 
                                                        
| 9966 | 9966 | |
| 9967 | 9967 | $parameters = array();  | 
                                                        
@@ -9975,14 +9975,14 @@ discard block  | 
                                                    ||
| 9975 | 9975 | // Left part of banner  | 
                                                        
| 9976 | 9976 |  		if ($morehtmlleft) { | 
                                                        
| 9977 | 9977 |  			if ($conf->browser->layout == 'phone') { | 
                                                        
| 9978 | - $ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>';  | 
                                                        |
| 9978 | + $ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>';  | 
                                                        |
| 9979 | 9979 |  			} else { | 
                                                        
| 9980 | - $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>';  | 
                                                        |
| 9980 | + $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';  | 
                                                        |
| 9981 | 9981 | }  | 
                                                        
| 9982 | 9982 | }  | 
                                                        
| 9983 | 9983 | |
| 9984 | 9984 | //if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';  | 
                                                        
| 9985 | - $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';  | 
                                                        |
| 9985 | + $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';  | 
                                                        |
| 9986 | 9986 | |
| 9987 | 9987 | // For thirdparty, contact, user, member, the ref is the id, so we show something else  | 
                                                        
| 9988 | 9988 |  		if ($object->element == 'societe') { | 
                                                        
@@ -9996,7 +9996,7 @@ discard block  | 
                                                    ||
| 9996 | 9996 | |
| 9997 | 9997 |  			if (is_array($arrayoflangcode) && count($arrayoflangcode)) { | 
                                                        
| 9998 | 9998 |  				if (!is_object($extralanguages)) { | 
                                                        
| 9999 | - include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';  | 
                                                        |
| 9999 | + include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';  | 
                                                        |
| 10000 | 10000 | $extralanguages = new ExtraLanguages($this->db);  | 
                                                        
| 10001 | 10001 | }  | 
                                                        
| 10002 | 10002 |  				$extralanguages->fetch_name_extralanguages('societe'); | 
                                                        
@@ -10011,29 +10011,29 @@ discard block  | 
                                                    ||
| 10011 | 10011 |  						if ($object->array_languages['name'][$extralangcode]) { | 
                                                        
| 10012 | 10012 | $htmltext .= $object->array_languages['name'][$extralangcode];  | 
                                                        
| 10013 | 10013 |  						} else { | 
                                                        
| 10014 | -							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; | 
                                                        |
| 10014 | +							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; | 
                                                        |
| 10015 | 10015 | }  | 
                                                        
| 10016 | 10016 | }  | 
                                                        
| 10017 | - $ret .= '<!-- Show translations of name -->' . "\n";  | 
                                                        |
| 10017 | + $ret .= '<!-- Show translations of name -->'."\n";  | 
                                                        |
| 10018 | 10018 |  					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); | 
                                                        
| 10019 | 10019 | }  | 
                                                        
| 10020 | 10020 | }  | 
                                                        
| 10021 | 10021 |  		} elseif ($object->element == 'member') { | 
                                                        
| 10022 | 10022 | '@phan-var-force Adherent $object';  | 
                                                        
| 10023 | - $ret .= $object->ref . '<br>';  | 
                                                        |
| 10023 | + $ret .= $object->ref.'<br>';  | 
                                                        |
| 10024 | 10024 | $fullname = $object->getFullName($langs);  | 
                                                        
| 10025 | 10025 |  			if ($object->morphy == 'mor' && $object->societe) { | 
                                                        
| 10026 | -				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); | 
                                                        |
| 10026 | +				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); | 
                                                        |
| 10027 | 10027 |  			} else { | 
                                                        
| 10028 | -				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); | 
                                                        |
| 10028 | +				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); | 
                                                        |
| 10029 | 10029 | }  | 
                                                        
| 10030 | 10030 |  		} elseif (in_array($object->element, array('contact', 'user'))) { | 
                                                        
| 10031 | - $ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt;  | 
                                                        |
| 10031 | + $ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt;  | 
                                                        |
| 10032 | 10032 |  		} elseif ($object->element == 'usergroup') { | 
                                                        
| 10033 | 10033 | $ret .= dol_htmlentities($object->name);  | 
                                                        
| 10034 | 10034 |  		} elseif (in_array($object->element, array('action', 'agenda'))) { | 
                                                        
| 10035 | 10035 | '@phan-var-force ActionComm $object';  | 
                                                        
| 10036 | - $ret .= $object->ref . '<br>' . $object->label;  | 
                                                        |
| 10036 | + $ret .= $object->ref.'<br>'.$object->label;  | 
                                                        |
| 10037 | 10037 |  		} elseif (in_array($object->element, array('adherent_type'))) { | 
                                                        
| 10038 | 10038 | $ret .= $object->label;  | 
                                                        
| 10039 | 10039 |  		} elseif ($object->element == 'ecm_directories') { | 
                                                        
@@ -10086,9 +10086,9 @@ discard block  | 
                                                    ||
| 10086 | 10086 | }  | 
                                                        
| 10087 | 10087 | |
| 10088 | 10088 | // Barcode image @phan-suppress-next-line PhanUndeclaredProperty  | 
                                                        
| 10089 | - $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);  | 
                                                        |
| 10090 | - $out = '<!-- url barcode = ' . $url . ' -->';  | 
                                                        |
| 10091 | - $out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>';  | 
                                                        |
| 10089 | + $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);  | 
                                                        |
| 10090 | + $out = '<!-- url barcode = '.$url.' -->';  | 
                                                        |
| 10091 | + $out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>';  | 
                                                        |
| 10092 | 10092 | |
| 10093 | 10093 | return $out;  | 
                                                        
| 10094 | 10094 | }  | 
                                                        
@@ -10115,7 +10115,7 @@ discard block  | 
                                                    ||
| 10115 | 10115 | global $conf, $langs;  | 
                                                        
| 10116 | 10116 | |
| 10117 | 10117 | $entity = (empty($object->entity) ? $conf->entity : $object->entity);  | 
                                                        
| 10118 | - $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)  | 
                                                        |
| 10118 | + $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)  | 
                                                        |
| 10119 | 10119 | |
| 10120 | 10120 | $dir = '';  | 
                                                        
| 10121 | 10121 | $file = '';  | 
                                                        
@@ -10128,28 +10128,28 @@ discard block  | 
                                                    ||
| 10128 | 10128 |  			if (!empty($object->logo)) { | 
                                                        
| 10129 | 10129 |  				if (dolIsAllowedForPreview($object->logo)) { | 
                                                        
| 10130 | 10130 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 10131 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs  | 
                                                        |
| 10131 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs  | 
                                                        |
| 10132 | 10132 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 10133 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');  | 
                                                        |
| 10133 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small');  | 
                                                        |
| 10134 | 10134 |  					} else { | 
                                                        
| 10135 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;  | 
                                                        |
| 10135 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;  | 
                                                        |
| 10136 | 10136 | }  | 
                                                        
| 10137 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;  | 
                                                        |
| 10137 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;  | 
                                                        |
| 10138 | 10138 | }  | 
                                                        
| 10139 | 10139 | }  | 
                                                        
| 10140 | 10140 | $email = $object->email;  | 
                                                        
| 10141 | 10141 |  		} elseif ($modulepart == 'contact') { | 
                                                        
| 10142 | - $dir = $conf->societe->multidir_output[$entity] . '/contact';  | 
                                                        |
| 10142 | + $dir = $conf->societe->multidir_output[$entity].'/contact';  | 
                                                        |
| 10143 | 10143 |  			if (!empty($object->photo)) { | 
                                                        
| 10144 | 10144 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
| 10145 | 10145 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 10146 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 10146 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 10147 | 10147 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 10148 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 10148 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 10149 | 10149 |  					} else { | 
                                                        
| 10150 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;  | 
                                                        |
| 10150 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;  | 
                                                        |
| 10151 | 10151 | }  | 
                                                        
| 10152 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;  | 
                                                        |
| 10152 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;  | 
                                                        |
| 10153 | 10153 | }  | 
                                                        
| 10154 | 10154 | }  | 
                                                        
| 10155 | 10155 | $email = $object->email;  | 
                                                        
@@ -10159,17 +10159,17 @@ discard block  | 
                                                    ||
| 10159 | 10159 |  			if (!empty($object->photo)) { | 
                                                        
| 10160 | 10160 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
| 10161 | 10161 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 10162 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 10162 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 10163 | 10163 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 10164 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 10164 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 10165 | 10165 |  					} else { | 
                                                        
| 10166 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;  | 
                                                        |
| 10166 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;  | 
                                                        |
| 10167 | 10167 | }  | 
                                                        
| 10168 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;  | 
                                                        |
| 10168 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;  | 
                                                        |
| 10169 | 10169 | }  | 
                                                        
| 10170 | 10170 | }  | 
                                                        
| 10171 | 10171 |  			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { | 
                                                        
| 10172 | - $altfile = $object->id . ".jpg"; // For backward compatibility  | 
                                                        |
| 10172 | + $altfile = $object->id.".jpg"; // For backward compatibility  | 
                                                        |
| 10173 | 10173 | }  | 
                                                        
| 10174 | 10174 | $email = $object->email;  | 
                                                        
| 10175 | 10175 | $capture = 'user';  | 
                                                        
@@ -10178,17 +10178,17 @@ discard block  | 
                                                    ||
| 10178 | 10178 |  			if (!empty($object->photo)) { | 
                                                        
| 10179 | 10179 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
| 10180 | 10180 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 10181 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 10181 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 10182 | 10182 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 10183 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 10183 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 10184 | 10184 |  					} else { | 
                                                        
| 10185 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;  | 
                                                        |
| 10185 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;  | 
                                                        |
| 10186 | 10186 | }  | 
                                                        
| 10187 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;  | 
                                                        |
| 10187 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;  | 
                                                        |
| 10188 | 10188 | }  | 
                                                        
| 10189 | 10189 | }  | 
                                                        
| 10190 | 10190 |  			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { | 
                                                        
| 10191 | - $altfile = $object->id . ".jpg"; // For backward compatibility  | 
                                                        |
| 10191 | + $altfile = $object->id.".jpg"; // For backward compatibility  | 
                                                        |
| 10192 | 10192 | }  | 
                                                        
| 10193 | 10193 | $email = $object->email;  | 
                                                        
| 10194 | 10194 | $capture = 'user';  | 
                                                        
@@ -10214,35 +10214,35 @@ discard block  | 
                                                    ||
| 10214 | 10214 | $ret = '';  | 
                                                        
| 10215 | 10215 | |
| 10216 | 10216 |  		if ($dir) { | 
                                                        
| 10217 | -			if ($file && file_exists($dir . "/" . $file)) { | 
                                                        |
| 10217 | +			if ($file && file_exists($dir."/".$file)) { | 
                                                        |
| 10218 | 10218 |  				if ($addlinktofullsize) { | 
                                                        
| 10219 | - $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);  | 
                                                        |
| 10219 | + $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);  | 
                                                        |
| 10220 | 10220 |  					if ($urladvanced) { | 
                                                        
| 10221 | - $ret .= '<a href="' . $urladvanced . '">';  | 
                                                        |
| 10221 | + $ret .= '<a href="'.$urladvanced.'">';  | 
                                                        |
| 10222 | 10222 |  					} else { | 
                                                        
| 10223 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';  | 
                                                        |
| 10223 | + $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';  | 
                                                        |
| 10224 | 10224 | }  | 
                                                        
| 10225 | 10225 | }  | 
                                                        
| 10226 | -				$ret .= '<img alt="" class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . ' photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($file) . '&cache=' . $cache . '">'; | 
                                                        |
| 10226 | +				$ret .= '<img alt="" class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').' photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">'; | 
                                                        |
| 10227 | 10227 |  				if ($addlinktofullsize) { | 
                                                        
| 10228 | 10228 | $ret .= '</a>';  | 
                                                        
| 10229 | 10229 | }  | 
                                                        
| 10230 | -			} elseif ($altfile && file_exists($dir . "/" . $altfile)) { | 
                                                        |
| 10230 | +			} elseif ($altfile && file_exists($dir."/".$altfile)) { | 
                                                        |
| 10231 | 10231 |  				if ($addlinktofullsize) { | 
                                                        
| 10232 | - $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);  | 
                                                        |
| 10232 | + $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);  | 
                                                        |
| 10233 | 10233 |  					if ($urladvanced) { | 
                                                        
| 10234 | - $ret .= '<a href="' . $urladvanced . '">';  | 
                                                        |
| 10234 | + $ret .= '<a href="'.$urladvanced.'">';  | 
                                                        |
| 10235 | 10235 |  					} else { | 
                                                        
| 10236 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';  | 
                                                        |
| 10236 | + $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';  | 
                                                        |
| 10237 | 10237 | }  | 
                                                        
| 10238 | 10238 | }  | 
                                                        
| 10239 | -				$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 . '">'; | 
                                                        |
| 10239 | +				$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.'">'; | 
                                                        |
| 10240 | 10240 |  				if ($addlinktofullsize) { | 
                                                        
| 10241 | 10241 | $ret .= '</a>';  | 
                                                        
| 10242 | 10242 | }  | 
                                                        
| 10243 | 10243 |  			} else { | 
                                                        
| 10244 | 10244 | $nophoto = '/public/theme/common/nophoto.png';  | 
                                                        
| 10245 | - $defaultimg = 'identicon'; // For gravatar  | 
                                                        |
| 10245 | + $defaultimg = 'identicon'; // For gravatar  | 
                                                        |
| 10246 | 10246 |  				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found | 
                                                        
| 10247 | 10247 |  					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) { | 
                                                        
| 10248 | 10248 | $nophoto = 'company';  | 
                                                        
@@ -10260,13 +10260,13 @@ discard block  | 
                                                    ||
| 10260 | 10260 |  				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { | 
                                                        
| 10261 | 10261 | // see https://gravatar.com/site/implement/images/php/  | 
                                                        
| 10262 | 10262 | $ret .= '<!-- Put link to gravatar -->';  | 
                                                        
| 10263 | - $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  | 
                                                        |
| 10263 | + $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  | 
                                                        |
| 10264 | 10264 |  				} else { | 
                                                        
| 10265 | 10265 |  					if ($nophoto == 'company') { | 
                                                        
| 10266 | -						$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; | 
                                                        |
| 10266 | +						$ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; | 
                                                        |
| 10267 | 10267 | //$ret .= '<div class="difforspanimgright"></div>';  | 
                                                        
| 10268 | 10268 |  					} else { | 
                                                        
| 10269 | - $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';  | 
                                                        |
| 10269 | + $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';  | 
                                                        |
| 10270 | 10270 | }  | 
                                                        
| 10271 | 10271 | }  | 
                                                        
| 10272 | 10272 | }  | 
                                                        
@@ -10277,15 +10277,15 @@ discard block  | 
                                                    ||
| 10277 | 10277 | }  | 
                                                        
| 10278 | 10278 | $ret .= '<table class="nobordernopadding centpercent">';  | 
                                                        
| 10279 | 10279 |  				if ($object->photo) { | 
                                                        
| 10280 | -					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; | 
                                                        |
| 10280 | +					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; | 
                                                        |
| 10281 | 10281 | }  | 
                                                        
| 10282 | 10282 | $ret .= '<tr><td class="tdoverflow">';  | 
                                                        
| 10283 | 10283 | $maxfilesizearray = getMaxFileSizeArray();  | 
                                                        
| 10284 | 10284 | $maxmin = $maxfilesizearray['maxmin'];  | 
                                                        
| 10285 | 10285 |  				if ($maxmin > 0) { | 
                                                        
| 10286 | - $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 10286 | + $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 10287 | 10287 | }  | 
                                                        
| 10288 | - $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>';  | 
                                                        |
| 10288 | + $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';  | 
                                                        |
| 10289 | 10289 | $ret .= '</td></tr>';  | 
                                                        
| 10290 | 10290 | $ret .= '</table>';  | 
                                                        
| 10291 | 10291 | }  | 
                                                        
@@ -10339,38 +10339,38 @@ discard block  | 
                                                    ||
| 10339 | 10339 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
| 10340 | 10340 | $sql .= ", e.label";  | 
                                                        
| 10341 | 10341 | }  | 
                                                        
| 10342 | - $sql .= " FROM " . $this->db->prefix() . "usergroup as ug ";  | 
                                                        |
| 10342 | + $sql .= " FROM ".$this->db->prefix()."usergroup as ug ";  | 
                                                        |
| 10343 | 10343 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
| 10344 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity";  | 
                                                        |
| 10344 | + $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";  | 
                                                        |
| 10345 | 10345 |  			if ($force_entity) { | 
                                                        
| 10346 | - $sql .= " WHERE ug.entity IN (0, " . $force_entity . ")";  | 
                                                        |
| 10346 | + $sql .= " WHERE ug.entity IN (0, ".$force_entity.")";  | 
                                                        |
| 10347 | 10347 |  			} else { | 
                                                        
| 10348 | 10348 | $sql .= " WHERE ug.entity IS NOT NULL";  | 
                                                        
| 10349 | 10349 | }  | 
                                                        
| 10350 | 10350 |  		} else { | 
                                                        
| 10351 | - $sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")";  | 
                                                        |
| 10351 | + $sql .= " WHERE ug.entity IN (0, ".$conf->entity.")";  | 
                                                        |
| 10352 | 10352 | }  | 
                                                        
| 10353 | 10353 |  		if (is_array($exclude) && $excludeGroups) { | 
                                                        
| 10354 | -			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; | 
                                                        |
| 10354 | +			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; | 
                                                        |
| 10355 | 10355 | }  | 
                                                        
| 10356 | 10356 |  		if (is_array($include) && $includeGroups) { | 
                                                        
| 10357 | -			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; | 
                                                        |
| 10357 | +			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; | 
                                                        |
| 10358 | 10358 | }  | 
                                                        
| 10359 | 10359 | $sql .= " ORDER BY ug.nom ASC";  | 
                                                        
| 10360 | 10360 | |
| 10361 | - dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);  | 
                                                        |
| 10361 | + dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);  | 
                                                        |
| 10362 | 10362 | $resql = $this->db->query($sql);  | 
                                                        
| 10363 | 10363 |  		if ($resql) { | 
                                                        
| 10364 | 10364 | // Enhance with select2  | 
                                                        
| 10365 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 10365 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 10366 | 10366 | |
| 10367 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 10367 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 10368 | 10368 | |
| 10369 | 10369 | $num = $this->db->num_rows($resql);  | 
                                                        
| 10370 | 10370 | $i = 0;  | 
                                                        
| 10371 | 10371 |  			if ($num) { | 
                                                        
| 10372 | 10372 |  				if ($show_empty && !$multiple) { | 
                                                        
| 10373 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n";  | 
                                                        |
| 10373 | + $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n";  | 
                                                        |
| 10374 | 10374 | }  | 
                                                        
| 10375 | 10375 | |
| 10376 | 10376 |  				while ($i < $num) { | 
                                                        
@@ -10383,11 +10383,11 @@ discard block  | 
                                                    ||
| 10383 | 10383 | $label = $obj->name;  | 
                                                        
| 10384 | 10384 | $labelhtml = $obj->name;  | 
                                                        
| 10385 | 10385 |  					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { | 
                                                        
| 10386 | -						$label .= " (" . $obj->label . ")"; | 
                                                        |
| 10387 | -						$labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; | 
                                                        |
| 10386 | +						$label .= " (".$obj->label.")"; | 
                                                        |
| 10387 | +						$labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; | 
                                                        |
| 10388 | 10388 | }  | 
                                                        
| 10389 | 10389 | |
| 10390 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 10390 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 10391 | 10391 |  					if ($disableline) { | 
                                                        
| 10392 | 10392 | $out .= ' disabled';  | 
                                                        
| 10393 | 10393 | }  | 
                                                        
@@ -10403,9 +10403,9 @@ discard block  | 
                                                    ||
| 10403 | 10403 | }  | 
                                                        
| 10404 | 10404 |  			} else { | 
                                                        
| 10405 | 10405 |  				if ($show_empty) { | 
                                                        
| 10406 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";  | 
                                                        |
| 10406 | + $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";  | 
                                                        |
| 10407 | 10407 | }  | 
                                                        
| 10408 | -				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; | 
                                                        |
| 10408 | +				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; | 
                                                        |
| 10409 | 10409 | }  | 
                                                        
| 10410 | 10410 | $out .= '</select>';  | 
                                                        
| 10411 | 10411 | |
@@ -10449,25 +10449,25 @@ discard block  | 
                                                    ||
| 10449 | 10449 | $out = '';  | 
                                                        
| 10450 | 10450 | |
| 10451 | 10451 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 10452 | - $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>';  | 
                                                        |
| 10452 | + $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>';  | 
                                                        |
| 10453 | 10453 | }  | 
                                                        
| 10454 | - $out .= '<script nonce="' . getNonce() . '">  | 
                                                        |
| 10454 | + $out .= '<script nonce="'.getNonce().'">  | 
                                                        |
| 10455 | 10455 |              $(document).ready(function() { | 
                                                        
| 10456 | -                $("#' . $cssclass . 's").click(function() { | 
                                                        |
| 10456 | +                $("#' . $cssclass.'s").click(function() { | 
                                                        |
| 10457 | 10457 |                      if($(this).is(\':checked\')){ | 
                                                        
| 10458 | -                        console.log("We check all ' . $cssclass . ' and trigger the change method"); | 
                                                        |
| 10459 | -                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); | 
                                                        |
| 10458 | +                        console.log("We check all ' . $cssclass.' and trigger the change method"); | 
                                                        |
| 10459 | +                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); | 
                                                        |
| 10460 | 10460 | }  | 
                                                        
| 10461 | 10461 | else  | 
                                                        
| 10462 | 10462 |                      { | 
                                                        
| 10463 | 10463 |                          console.log("We uncheck all"); | 
                                                        
| 10464 | -                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); | 
                                                        |
| 10464 | +                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); | 
                                                        |
| 10465 | 10465 | }' . "\n";  | 
                                                        
| 10466 | 10466 |  		if ($calljsfunction) { | 
                                                        
| 10467 | -			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; | 
                                                        |
| 10467 | +			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; | 
                                                        |
| 10468 | 10468 | }  | 
                                                        
| 10469 | 10469 | $out .= ' });  | 
                                                        
| 10470 | -        	        $(".' . $cssclass . '").change(function() { | 
                                                        |
| 10470 | +        	        $(".' . $cssclass.'").change(function() { | 
                                                        |
| 10471 | 10471 |  					$(this).closest("tr").toggleClass("highlight", this.checked); | 
                                                        
| 10472 | 10472 | });  | 
                                                        
| 10473 | 10473 | });  | 
                                                        
@@ -10512,67 +10512,67 @@ discard block  | 
                                                    ||
| 10512 | 10512 | global $langs, $user;  | 
                                                        
| 10513 | 10513 | |
| 10514 | 10514 | $out = '';  | 
                                                        
| 10515 | - $sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1";  | 
                                                        |
| 10516 | -		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; | 
                                                        |
| 10515 | + $sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";  | 
                                                        |
| 10516 | +		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; | 
                                                        |
| 10517 | 10517 |  		if (!empty($excludeid)) { | 
                                                        
| 10518 | -			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; | 
                                                        |
| 10518 | +			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; | 
                                                        |
| 10519 | 10519 | }  | 
                                                        
| 10520 | 10520 | $sql .= " ORDER BY label";  | 
                                                        
| 10521 | 10521 | |
| 10522 | 10522 | $resql = $this->db->query($sql);  | 
                                                        
| 10523 | 10523 |  		if ($resql) { | 
                                                        
| 10524 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">';  | 
                                                        |
| 10524 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';  | 
                                                        |
| 10525 | 10525 |  			if ($useempty) { | 
                                                        
| 10526 | 10526 | $out .= '<option value="0"> </option>';  | 
                                                        
| 10527 | 10527 | }  | 
                                                        
| 10528 | 10528 | |
| 10529 | 10529 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
| 10530 | - $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';  | 
                                                        |
| 10530 | + $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';  | 
                                                        |
| 10531 | 10531 | }  | 
                                                        
| 10532 | 10532 | $out .= '</select>';  | 
                                                        
| 10533 | -			$out .= ajax_combobox('select_' . $htmlname); | 
                                                        |
| 10533 | +			$out .= ajax_combobox('select_'.$htmlname); | 
                                                        |
| 10534 | 10534 | |
| 10535 | 10535 |  			if (!empty($htmlname) && $user->admin && $info_admin) { | 
                                                        
| 10536 | -				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        |
| 10536 | +				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        |
| 10537 | 10537 | }  | 
                                                        
| 10538 | 10538 | |
| 10539 | 10539 |  			if (!empty($target)) { | 
                                                        
| 10540 | - $sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";  | 
                                                        |
| 10540 | + $sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";  | 
                                                        |
| 10541 | 10541 | $resql = $this->db->query($sql);  | 
                                                        
| 10542 | 10542 |  				if ($resql) { | 
                                                        
| 10543 | 10543 |  					if ($this->db->num_rows($resql) > 0) { | 
                                                        
| 10544 | 10544 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 10545 | - $out .= '<script nonce="' . getNonce() . '">  | 
                                                        |
| 10545 | + $out .= '<script nonce="'.getNonce().'">  | 
                                                        |
| 10546 | 10546 |  							$(function() { | 
                                                        
| 10547 | -								$("select[name=' . $target . ']").on("change", function() { | 
                                                        |
| 10547 | +								$("select[name=' . $target.']").on("change", function() { | 
                                                        |
| 10548 | 10548 | var current_val = $(this).val();  | 
                                                        
| 10549 | -									if (current_val == ' . $obj->id . ') {'; | 
                                                        |
| 10549 | +									if (current_val == ' . $obj->id.') {'; | 
                                                        |
| 10550 | 10550 |  						if (!empty($default_selected) || !empty($selected)) { | 
                                                        
| 10551 | -							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; | 
                                                        |
| 10551 | +							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; | 
                                                        |
| 10552 | 10552 | }  | 
                                                        
| 10553 | 10553 | |
| 10554 | 10554 | $out .= '  | 
                                                        
| 10555 | -										$("select[name=' . $htmlname . ']").change(); | 
                                                        |
| 10555 | +										$("select[name=' . $htmlname.']").change(); | 
                                                        |
| 10556 | 10556 | }  | 
                                                        
| 10557 | 10557 | });  | 
                                                        
| 10558 | 10558 | |
| 10559 | -								$("select[name=' . $htmlname . ']").change(function() { | 
                                                        |
| 10559 | +								$("select[name=' . $htmlname.']").change(function() { | 
                                                        |
| 10560 | 10560 | |
| 10561 | -									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { | 
                                                        |
| 10561 | +									if ($("select[name=' . $target.']").val() == '.$obj->id.') { | 
                                                        |
| 10562 | 10562 | // get price of kilometer to fill the unit price  | 
                                                        
| 10563 | 10563 |  										$.ajax({ | 
                                                        
| 10564 | 10564 | method: "POST",  | 
                                                        
| 10565 | 10565 | dataType: "json",  | 
                                                        
| 10566 | -											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, | 
                                                        |
| 10567 | -											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '", | 
                                                        |
| 10566 | +											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, | 
                                                        |
| 10567 | +											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'", | 
                                                        |
| 10568 | 10568 |  										}).done(function( data, textStatus, jqXHR ) { | 
                                                        
| 10569 | 10569 | console.log(data);  | 
                                                        
| 10570 | 10570 |  											if (typeof data.up != "undefined") { | 
                                                        
| 10571 | 10571 |  												$("input[name=value_unit]").val(data.up); | 
                                                        
| 10572 | -												$("select[name=' . $htmlname . ']").attr("title", data.title); | 
                                                        |
| 10572 | +												$("select[name=' . $htmlname.']").attr("title", data.title); | 
                                                        |
| 10573 | 10573 |  											} else { | 
                                                        
| 10574 | 10574 |  												$("input[name=value_unit]").val(""); | 
                                                        
| 10575 | -												$("select[name=' . $htmlname . ']").attr("title", ""); | 
                                                        |
| 10575 | +												$("select[name=' . $htmlname.']").attr("title", ""); | 
                                                        |
| 10576 | 10576 | }  | 
                                                        
| 10577 | 10577 | });  | 
                                                        
| 10578 | 10578 | }  | 
                                                        
@@ -10602,18 +10602,18 @@ discard block  | 
                                                    ||
| 10602 | 10602 | global $conf, $langs;  | 
                                                        
| 10603 | 10603 | |
| 10604 | 10604 | $out = '';  | 
                                                        
| 10605 | - $sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range";  | 
                                                        |
| 10606 | - $sql .= " WHERE entity = " . $conf->entity . " AND active = 1";  | 
                                                        |
| 10605 | + $sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";  | 
                                                        |
| 10606 | + $sql .= " WHERE entity = ".$conf->entity." AND active = 1";  | 
                                                        |
| 10607 | 10607 | |
| 10608 | 10608 | $resql = $this->db->query($sql);  | 
                                                        
| 10609 | 10609 |  		if ($resql) { | 
                                                        
| 10610 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';  | 
                                                        |
| 10610 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';  | 
                                                        |
| 10611 | 10611 |  			if ($useempty) { | 
                                                        
| 10612 | 10612 | $out .= '<option value="0"></option>';  | 
                                                        
| 10613 | 10613 | }  | 
                                                        
| 10614 | 10614 | |
| 10615 | 10615 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
| 10616 | - $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';  | 
                                                        |
| 10616 | + $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';  | 
                                                        |
| 10617 | 10617 | }  | 
                                                        
| 10618 | 10618 | $out .= '</select>';  | 
                                                        
| 10619 | 10619 |  		} else { | 
                                                        
@@ -10644,12 +10644,12 @@ discard block  | 
                                                    ||
| 10644 | 10644 | |
| 10645 | 10645 | $resql = $this->db->query($sql);  | 
                                                        
| 10646 | 10646 |  		if ($resql) { | 
                                                        
| 10647 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';  | 
                                                        |
| 10647 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';  | 
                                                        |
| 10648 | 10648 |  			if ($useempty) { | 
                                                        
| 10649 | 10649 | $out .= '<option value="0"></option>';  | 
                                                        
| 10650 | 10650 | }  | 
                                                        
| 10651 | 10651 |  			if ($allchoice) { | 
                                                        
| 10652 | -				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; | 
                                                        |
| 10652 | +				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; | 
                                                        |
| 10653 | 10653 | }  | 
                                                        
| 10654 | 10654 | |
| 10655 | 10655 | $field = 'code';  | 
                                                        
@@ -10659,7 +10659,7 @@ discard block  | 
                                                    ||
| 10659 | 10659 | |
| 10660 | 10660 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
| 10661 | 10661 | $key = $langs->trans($obj->code);  | 
                                                        
| 10662 | -				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; | 
                                                        |
| 10662 | +				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; | 
                                                        |
| 10663 | 10663 | }  | 
                                                        
| 10664 | 10664 | $out .= '</select>';  | 
                                                        
| 10665 | 10665 | |
@@ -10693,7 +10693,7 @@ discard block  | 
                                                    ||
| 10693 | 10693 |  	{ | 
                                                        
| 10694 | 10694 | global $user, $conf, $langs;  | 
                                                        
| 10695 | 10695 | |
| 10696 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 10696 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 10697 | 10697 | |
| 10698 | 10698 |  		if (is_null($usertofilter)) { | 
                                                        
| 10699 | 10699 | $usertofilter = $user;  | 
                                                        
@@ -10717,10 +10717,10 @@ discard block  | 
                                                    ||
| 10717 | 10717 | $sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,  | 
                                                        
| 10718 | 10718 | p.title, p.fk_soc, p.fk_statut, p.public,";  | 
                                                        
| 10719 | 10719 | $sql .= ' s.nom as name';  | 
                                                        
| 10720 | - $sql .= ' FROM ' . $this->db->prefix() . 'projet as p';  | 
                                                        |
| 10721 | - $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,';  | 
                                                        |
| 10722 | - $sql .= ' ' . $this->db->prefix() . 'facture as f';  | 
                                                        |
| 10723 | -		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; | 
                                                        |
| 10720 | + $sql .= ' FROM '.$this->db->prefix().'projet as p';  | 
                                                        |
| 10721 | + $sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';  | 
                                                        |
| 10722 | + $sql .= ' '.$this->db->prefix().'facture as f';  | 
                                                        |
| 10723 | +		$sql .= " WHERE p.entity IN (".getEntity('project').")"; | 
                                                        |
| 10724 | 10724 | $sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement  | 
                                                        
| 10725 | 10725 |  		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; | 
                                                        
| 10726 | 10726 | //if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";  | 
                                                        
@@ -10731,14 +10731,14 @@ discard block  | 
                                                    ||
| 10731 | 10731 |  		if ($resql) { | 
                                                        
| 10732 | 10732 | // Use select2 selector  | 
                                                        
| 10733 | 10733 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 10734 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 10734 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 10735 | 10735 | $comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);  | 
                                                        
| 10736 | 10736 | $out .= $comboenhancement;  | 
                                                        
| 10737 | 10737 | $morecss = 'minwidth200imp maxwidth500';  | 
                                                        
| 10738 | 10738 | }  | 
                                                        
| 10739 | 10739 | |
| 10740 | 10740 |  			if (empty($option_only)) { | 
                                                        
| 10741 | - $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 10741 | + $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 10742 | 10742 | }  | 
                                                        
| 10743 | 10743 |  			if (!empty($show_empty)) { | 
                                                        
| 10744 | 10744 | $out .= '<option value="0" class="optiongrey">';  | 
                                                        
@@ -10768,33 +10768,33 @@ discard block  | 
                                                    ||
| 10768 | 10768 |  						if ($showproject == 'all') { | 
                                                        
| 10769 | 10769 | $labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref  | 
                                                        
| 10770 | 10770 |  							if ($obj->name) { | 
                                                        
| 10771 | - $labeltoshow .= ' - ' . $obj->name; // Soc name  | 
                                                        |
| 10771 | + $labeltoshow .= ' - '.$obj->name; // Soc name  | 
                                                        |
| 10772 | 10772 | }  | 
                                                        
| 10773 | 10773 | |
| 10774 | 10774 | $disabled = 0;  | 
                                                        
| 10775 | 10775 |  							if ($obj->fk_statut == Project::STATUS_DRAFT) { | 
                                                        
| 10776 | 10776 | $disabled = 1;  | 
                                                        
| 10777 | -								$labeltoshow .= ' - ' . $langs->trans("Draft"); | 
                                                        |
| 10777 | +								$labeltoshow .= ' - '.$langs->trans("Draft"); | 
                                                        |
| 10778 | 10778 |  							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) { | 
                                                        
| 10779 | 10779 |  								if ($discard_closed == 2) { | 
                                                        
| 10780 | 10780 | $disabled = 1;  | 
                                                        
| 10781 | 10781 | }  | 
                                                        
| 10782 | -								$labeltoshow .= ' - ' . $langs->trans("Closed"); | 
                                                        |
| 10782 | +								$labeltoshow .= ' - '.$langs->trans("Closed"); | 
                                                        |
| 10783 | 10783 |  							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { | 
                                                        
| 10784 | 10784 | $disabled = 1;  | 
                                                        
| 10785 | -								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); | 
                                                        |
| 10785 | +								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); | 
                                                        |
| 10786 | 10786 | }  | 
                                                        
| 10787 | 10787 | }  | 
                                                        
| 10788 | 10788 | |
| 10789 | 10789 |  						if (!empty($selected) && $selected == $obj->rowid) { | 
                                                        
| 10790 | - $out .= '<option value="' . $obj->rowid . '" selected';  | 
                                                        |
| 10790 | + $out .= '<option value="'.$obj->rowid.'" selected';  | 
                                                        |
| 10791 | 10791 | //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled  | 
                                                        
| 10792 | - $out .= '>' . $labeltoshow . '</option>';  | 
                                                        |
| 10792 | + $out .= '>'.$labeltoshow.'</option>';  | 
                                                        |
| 10793 | 10793 |  						} else { | 
                                                        
| 10794 | 10794 |  							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { | 
                                                        
| 10795 | 10795 | $resultat = '';  | 
                                                        
| 10796 | 10796 |  							} else { | 
                                                        
| 10797 | - $resultat = '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 10797 | + $resultat = '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 10798 | 10798 |  								if ($disabled) { | 
                                                        
| 10799 | 10799 | $resultat .= ' disabled';  | 
                                                        
| 10800 | 10800 | }  | 
                                                        
@@ -10846,22 +10846,22 @@ discard block  | 
                                                    ||
| 10846 | 10846 | |
| 10847 | 10847 | $sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';  | 
                                                        
| 10848 | 10848 | //$sql.= ', el.fk_source';  | 
                                                        
| 10849 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';  | 
                                                        |
| 10850 | -		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; | 
                                                        |
| 10849 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';  | 
                                                        |
| 10850 | +		$sql .= " WHERE f.entity IN (".getEntity('invoice').")"; | 
                                                        |
| 10851 | 10851 | $sql .= " ORDER BY f.titre ASC";  | 
                                                        
| 10852 | 10852 | |
| 10853 | 10853 | $resql = $this->db->query($sql);  | 
                                                        
| 10854 | 10854 |  		if ($resql) { | 
                                                        
| 10855 | 10855 | // Use select2 selector  | 
                                                        
| 10856 | 10856 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 10857 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 10857 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 10858 | 10858 | $comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);  | 
                                                        
| 10859 | 10859 | $out .= $comboenhancement;  | 
                                                        
| 10860 | 10860 | $morecss = 'minwidth200imp maxwidth500';  | 
                                                        
| 10861 | 10861 | }  | 
                                                        
| 10862 | 10862 | |
| 10863 | 10863 |  			if (empty($option_only)) { | 
                                                        
| 10864 | - $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 10864 | + $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 10865 | 10865 | }  | 
                                                        
| 10866 | 10866 |  			if (!empty($show_empty)) { | 
                                                        
| 10867 | 10867 | $out .= '<option value="0" class="optiongrey">';  | 
                                                        
@@ -10880,19 +10880,19 @@ discard block  | 
                                                    ||
| 10880 | 10880 | $disabled = 0;  | 
                                                        
| 10881 | 10881 |  					if (!empty($obj->suspended)) { | 
                                                        
| 10882 | 10882 | $disabled = 1;  | 
                                                        
| 10883 | -						$labeltoshow .= ' - ' . $langs->trans("Closed"); | 
                                                        |
| 10883 | +						$labeltoshow .= ' - '.$langs->trans("Closed"); | 
                                                        |
| 10884 | 10884 | }  | 
                                                        
| 10885 | 10885 | |
| 10886 | 10886 | |
| 10887 | 10887 |  					if (!empty($selected) && $selected == $obj->rowid) { | 
                                                        
| 10888 | - $out .= '<option value="' . $obj->rowid . '" selected';  | 
                                                        |
| 10888 | + $out .= '<option value="'.$obj->rowid.'" selected';  | 
                                                        |
| 10889 | 10889 | //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled  | 
                                                        
| 10890 | - $out .= '>' . $labeltoshow . '</option>';  | 
                                                        |
| 10890 | + $out .= '>'.$labeltoshow.'</option>';  | 
                                                        |
| 10891 | 10891 |  					} else { | 
                                                        
| 10892 | 10892 |  						if ($disabled && ($selected != $obj->rowid)) { | 
                                                        
| 10893 | 10893 | $resultat = '';  | 
                                                        
| 10894 | 10894 |  						} else { | 
                                                        
| 10895 | - $resultat = '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 10895 | + $resultat = '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 10896 | 10896 |  							if ($disabled) { | 
                                                        
| 10897 | 10897 | $resultat .= ' disabled';  | 
                                                        
| 10898 | 10898 | }  | 
                                                        
@@ -10932,14 +10932,14 @@ discard block  | 
                                                    ||
| 10932 | 10932 | global $langs;  | 
                                                        
| 10933 | 10933 | |
| 10934 | 10934 |  		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with () | 
                                                        
| 10935 | -			$search_component_params_hidden = '(' . $search_component_params_hidden . ')'; | 
                                                        |
| 10935 | +			$search_component_params_hidden = '('.$search_component_params_hidden.')'; | 
                                                        |
| 10936 | 10936 | }  | 
                                                        
| 10937 | 10937 | |
| 10938 | 10938 | $ret = '';  | 
                                                        
| 10939 | 10939 | |
| 10940 | 10940 | $ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">';  | 
                                                        
| 10941 | 10941 | $ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';  | 
                                                        
| 10942 | -		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; | 
                                                        |
| 10942 | +		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; | 
                                                        |
| 10943 | 10943 | $ret .= '</a>';  | 
                                                        
| 10944 | 10944 | |
| 10945 | 10945 | $ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';  | 
                                                        
@@ -10983,29 +10983,29 @@ discard block  | 
                                                    ||
| 10983 | 10983 | $ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';  | 
                                                        
| 10984 | 10984 | }  | 
                                                        
| 10985 | 10985 | $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%')) -->";  | 
                                                        
| 10986 | - $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">';  | 
                                                        |
| 10986 | + $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';  | 
                                                        |
| 10987 | 10987 | // $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->";  | 
                                                        
| 10988 | 10988 | |
| 10989 | 10989 | // For compatibility with forms that show themself the search criteria in addition of this component, we output these fields  | 
                                                        
| 10990 | 10990 |  		foreach ($arrayofcriterias as $criteria) { | 
                                                        
| 10991 | 10991 |  			foreach ($criteria as $criteriafamilykey => $criteriafamilyval) { | 
                                                        
| 10992 | -				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { | 
                                                        |
| 10992 | +				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { | 
                                                        |
| 10993 | 10993 | continue;  | 
                                                        
| 10994 | 10994 | }  | 
                                                        
| 10995 | 10995 |  				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { | 
                                                        
| 10996 | 10996 | continue;  | 
                                                        
| 10997 | 10997 | }  | 
                                                        
| 10998 | 10998 |  				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { | 
                                                        
| 10999 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">';  | 
                                                        |
| 11000 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">';  | 
                                                        |
| 11001 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">';  | 
                                                        |
| 11002 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">';  | 
                                                        |
| 11003 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">';  | 
                                                        |
| 11004 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">';  | 
                                                        |
| 11005 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">';  | 
                                                        |
| 11006 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">';  | 
                                                        |
| 10999 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';  | 
                                                        |
| 11000 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';  | 
                                                        |
| 11001 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';  | 
                                                        |
| 11002 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';  | 
                                                        |
| 11003 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';  | 
                                                        |
| 11004 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';  | 
                                                        |
| 11005 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';  | 
                                                        |
| 11006 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';  | 
                                                        |
| 11007 | 11007 |  				} else { | 
                                                        
| 11008 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">';  | 
                                                        |
| 11008 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';  | 
                                                        |
| 11009 | 11009 | }  | 
                                                        
| 11010 | 11010 | }  | 
                                                        
| 11011 | 11011 | }  | 
                                                        
@@ -11013,7 +11013,7 @@ discard block  | 
                                                    ||
| 11013 | 11013 | $ret .= '</div>';  | 
                                                        
| 11014 | 11014 | |
| 11015 | 11015 | $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";  | 
                                                        
| 11016 | -		$ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; | 
                                                        |
| 11016 | +		$ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; | 
                                                        |
| 11017 | 11017 | |
| 11018 | 11018 | $ret .= '</div>';  | 
                                                        
| 11019 | 11019 | $ret .= '</div>';  | 
                                                        
@@ -11087,7 +11087,7 @@ discard block  | 
                                                    ||
| 11087 | 11087 | |
| 11088 | 11088 | $TModels = array();  | 
                                                        
| 11089 | 11089 | |
| 11090 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';  | 
                                                        |
| 11090 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';  | 
                                                        |
| 11091 | 11091 | $formmail = new FormMail($this->db);  | 
                                                        
| 11092 | 11092 | $result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);  | 
                                                        
| 11093 | 11093 | |
@@ -11100,17 +11100,17 @@ discard block  | 
                                                    ||
| 11100 | 11100 | }  | 
                                                        
| 11101 | 11101 | }  | 
                                                        
| 11102 | 11102 | |
| 11103 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">';  | 
                                                        |
| 11103 | + $retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';  | 
                                                        |
| 11104 | 11104 | |
| 11105 | 11105 |  		foreach ($TModels as $id_model => $label_model) { | 
                                                        
| 11106 | - $retstring .= '<option value="' . $id_model . '"';  | 
                                                        |
| 11107 | - $retstring .= ">" . $label_model . "</option>";  | 
                                                        |
| 11106 | + $retstring .= '<option value="'.$id_model.'"';  | 
                                                        |
| 11107 | + $retstring .= ">".$label_model."</option>";  | 
                                                        |
| 11108 | 11108 | }  | 
                                                        
| 11109 | 11109 | |
| 11110 | 11110 | $retstring .= "</select>";  | 
                                                        
| 11111 | 11111 | |
| 11112 | 11112 |  		if ($addjscombo) { | 
                                                        
| 11113 | -			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); | 
                                                        |
| 11113 | +			$retstring .= ajax_combobox('select_'.$prefix.'model_mail'); | 
                                                        |
| 11114 | 11114 | }  | 
                                                        
| 11115 | 11115 | |
| 11116 | 11116 | return $retstring;  | 
                                                        
@@ -11161,16 +11161,16 @@ discard block  | 
                                                    ||
| 11161 | 11161 | |
| 11162 | 11162 |  		foreach ($buttons as $button) { | 
                                                        
| 11163 | 11163 | $addclass = empty($button['addclass']) ? '' : $button['addclass'];  | 
                                                        
| 11164 | - $retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">';  | 
                                                        |
| 11164 | + $retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';  | 
                                                        |
| 11165 | 11165 | }  | 
                                                        
| 11166 | 11166 | $retstring .= $withoutdiv ? '' : '</div>';  | 
                                                        
| 11167 | 11167 | |
| 11168 | 11168 |  		if ($dol_openinpopup) { | 
                                                        
| 11169 | - $retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . dol_escape_htmltag($dol_openinpopup) . ' context, so we enable the close of dialog on cancel -->' . "\n";  | 
                                                        |
| 11170 | - $retstring .= '<script nonce="' . getNonce() . '">';  | 
                                                        |
| 11169 | + $retstring .= '<!-- buttons are shown into a $dol_openinpopup='.dol_escape_htmltag($dol_openinpopup).' context, so we enable the close of dialog on cancel -->'."\n";  | 
                                                        |
| 11170 | + $retstring .= '<script nonce="'.getNonce().'">';  | 
                                                        |
| 11171 | 11171 |  			$retstring .= 'jQuery(".button-cancel").click(function(e) { | 
                                                        
| 11172 | - e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup) . '\');  | 
                                                        |
| 11173 | - window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup) . '\').dialog(\'close\');  | 
                                                        |
| 11172 | + e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup).'\');  | 
                                                        |
| 11173 | + window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup).'\').dialog(\'close\');  | 
                                                        |
| 11174 | 11174 | });';  | 
                                                        
| 11175 | 11175 | $retstring .= '</script>';  | 
                                                        
| 11176 | 11176 | }  | 
                                                        
@@ -11199,7 +11199,7 @@ discard block  | 
                                                    ||
| 11199 | 11199 | dol_syslog(__METHOD__, LOG_DEBUG);  | 
                                                        
| 11200 | 11200 | |
| 11201 | 11201 | $sql = "SELECT rowid, code, label as label";  | 
                                                        
| 11202 | - $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';  | 
                                                        |
| 11202 | + $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';  | 
                                                        |
| 11203 | 11203 | $sql .= " WHERE active = 1";  | 
                                                        
| 11204 | 11204 | |
| 11205 | 11205 | $resql = $this->db->query($sql);  | 
                                                        
@@ -11210,7 +11210,7 @@ discard block  | 
                                                    ||
| 11210 | 11210 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 11211 | 11211 | |
| 11212 | 11212 | // If translation exists, we use it, otherwise we take the default wording  | 
                                                        
| 11213 | -				$label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); | 
                                                        |
| 11213 | +				$label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); | 
                                                        |
| 11214 | 11214 | $this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid;  | 
                                                        
| 11215 | 11215 | $this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 11216 | 11216 | $this->cache_invoice_subtype[$obj->rowid]['label'] = $label;  | 
                                                        
@@ -11242,18 +11242,18 @@ discard block  | 
                                                    ||
| 11242 | 11242 | global $langs, $user;  | 
                                                        
| 11243 | 11243 | |
| 11244 | 11244 | $out = '';  | 
                                                        
| 11245 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 11245 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 11246 | 11246 | |
| 11247 | 11247 | $this->load_cache_invoice_subtype();  | 
                                                        
| 11248 | 11248 | |
| 11249 | - $out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 11249 | + $out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 11250 | 11250 |  		if ($addempty) { | 
                                                        
| 11251 | 11251 | $out .= '<option value="0"> </option>';  | 
                                                        
| 11252 | 11252 | }  | 
                                                        
| 11253 | 11253 | |
| 11254 | 11254 |  		foreach ($this->cache_invoice_subtype as $rowid => $subtype) { | 
                                                        
| 11255 | 11255 | $label = $subtype['label'];  | 
                                                        
| 11256 | - $out .= '<option value="' . $subtype['rowid'] . '"';  | 
                                                        |
| 11256 | + $out .= '<option value="'.$subtype['rowid'].'"';  | 
                                                        |
| 11257 | 11257 |  			if ($selected == $subtype['rowid']) { | 
                                                        
| 11258 | 11258 | $out .= ' selected="selected"';  | 
                                                        
| 11259 | 11259 | }  | 
                                                        
@@ -1506,7 +1506,7 @@ discard block  | 
                                                    ||
| 1506 | 1506 | */  | 
                                                        
| 1507 | 1507 | public function insert_cronjobs()  | 
                                                        
| 1508 | 1508 |  	{ | 
                                                        
| 1509 | - // phpcs:enable  | 
                                                        |
| 1509 | + // phpcs:enable  | 
                                                        |
| 1510 | 1510 | include_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';  | 
                                                        
| 1511 | 1511 | include_once DOL_DOCUMENT_ROOT . '/cron/class/cronjob.class.php';  | 
                                                        
| 1512 | 1512 | |
@@ -1611,7 +1611,7 @@ discard block  | 
                                                    ||
| 1611 | 1611 | return $err;  | 
                                                        
| 1612 | 1612 | }  | 
                                                        
| 1613 | 1613 | |
| 1614 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps  | 
                                                        |
| 1614 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps  | 
                                                        |
| 1615 | 1615 | /**  | 
                                                        
| 1616 | 1616 | * Removes boxes  | 
                                                        
| 1617 | 1617 | *  | 
                                                        
@@ -140,7 +140,7 @@ discard block  | 
                                                    ||
| 140 | 140 | |
| 141 | 141 | const KEY_ID = 0;  | 
                                                        
| 142 | 142 | const KEY_LABEL = 1;  | 
                                                        
| 143 | - const KEY_TYPE = 2; // deprecated  | 
                                                        |
| 143 | + const KEY_TYPE = 2; // deprecated  | 
                                                        |
| 144 | 144 | const KEY_DEFAULT = 3;  | 
                                                        
| 145 | 145 | const KEY_FIRST_LEVEL = 4;  | 
                                                        
| 146 | 146 | const KEY_SECOND_LEVEL = 5;  | 
                                                        
@@ -624,7 +624,7 @@ discard block  | 
                                                    ||
| 624 | 624 | $moduleNameInConf = 'supplier_proposal';  | 
                                                        
| 625 | 625 | }  | 
                                                        
| 626 | 626 | |
| 627 | - unset($conf->modules[$moduleNameInConf]); // Add this module in list of enabled modules so isModEnabled() will work (conf->module->enabled must no more be used)  | 
                                                        |
| 627 | + unset($conf->modules[$moduleNameInConf]); // Add this module in list of enabled modules so isModEnabled() will work (conf->module->enabled must no more be used)  | 
                                                        |
| 628 | 628 | |
| 629 | 629 | return 1;  | 
                                                        
| 630 | 630 |  		} else { | 
                                                        
@@ -720,7 +720,7 @@ discard block  | 
                                                    ||
| 720 | 720 | $pathoffile = $this->getDescLongReadmeFound();  | 
                                                        
| 721 | 721 | |
| 722 | 722 |  		if ($pathoffile) {     // Mostly for external modules | 
                                                        
| 723 | - $content = file_get_contents($pathoffile, false, null, 0, 1024 * 1024); // Max size loaded 1Mb  | 
                                                        |
| 723 | + $content = file_get_contents($pathoffile, false, null, 0, 1024 * 1024); // Max size loaded 1Mb  | 
                                                        |
| 724 | 724 | |
| 725 | 725 |  			if ((float) DOL_VERSION >= 6.0) { | 
                                                        
| 726 | 726 | @include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';  | 
                                                        
@@ -1484,7 +1484,7 @@ discard block  | 
                                                    ||
| 1484 | 1484 | |
| 1485 | 1485 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def";  | 
                                                        
| 1486 | 1486 | $sql .= " WHERE file = '".$this->db->escape($file)."'";  | 
                                                        
| 1487 | - $sql .= " AND entity = ".$conf->entity; // Do not use getEntity here, we want to delete only in current company  | 
                                                        |
| 1487 | + $sql .= " AND entity = ".$conf->entity; // Do not use getEntity here, we want to delete only in current company  | 
                                                        |
| 1488 | 1488 | |
| 1489 | 1489 | dol_syslog(get_class($this)."::delete_boxes", LOG_DEBUG);  | 
                                                        
| 1490 | 1490 | $resql = $this->db->query($sql);  | 
                                                        
@@ -1507,15 +1507,15 @@ discard block  | 
                                                    ||
| 1507 | 1507 | public function insert_cronjobs()  | 
                                                        
| 1508 | 1508 |  	{ | 
                                                        
| 1509 | 1509 | // phpcs:enable  | 
                                                        
| 1510 | - include_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';  | 
                                                        |
| 1511 | - include_once DOL_DOCUMENT_ROOT . '/cron/class/cronjob.class.php';  | 
                                                        |
| 1510 | + include_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';  | 
                                                        |
| 1511 | + include_once DOL_DOCUMENT_ROOT.'/cron/class/cronjob.class.php';  | 
                                                        |
| 1512 | 1512 | |
| 1513 | 1513 | global $conf, $user;  | 
                                                        
| 1514 | 1514 | |
| 1515 | 1515 | $err = 0;  | 
                                                        
| 1516 | 1516 | |
| 1517 | 1517 |  		if (is_array($this->cronjobs)) { | 
                                                        
| 1518 | - dol_syslog(get_class($this) . "::insert_cronjobs", LOG_DEBUG);  | 
                                                        |
| 1518 | + dol_syslog(get_class($this)."::insert_cronjobs", LOG_DEBUG);  | 
                                                        |
| 1519 | 1519 | |
| 1520 | 1520 |  			foreach ($this->cronjobs as $key => $value) { | 
                                                        
| 1521 | 1521 | $now = dol_now();  | 
                                                        
@@ -1542,25 +1542,25 @@ discard block  | 
                                                    ||
| 1542 | 1542 | $test = isset($value['test']) ? $value['test'] : ''; // Line must be enabled or not (so visible or not)  | 
                                                        
| 1543 | 1543 | |
| 1544 | 1544 | // Search if cron entry already present  | 
                                                        
| 1545 | - $sql = "SELECT count(*) as nb FROM " . MAIN_DB_PREFIX . "cronjob";  | 
                                                        |
| 1545 | + $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";  | 
                                                        |
| 1546 | 1546 | //$sql .= " WHERE module_name = '" . $this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class) . "'";  | 
                                                        
| 1547 | 1547 | $sql .= " WHERE label = '".$this->db->escape($label)."'";  | 
                                                        
| 1548 | 1548 |  				if ($classesname) { | 
                                                        
| 1549 | - $sql .= " AND classesname = '" . $this->db->escape($classesname) . "'";  | 
                                                        |
| 1549 | + $sql .= " AND classesname = '".$this->db->escape($classesname)."'";  | 
                                                        |
| 1550 | 1550 | }  | 
                                                        
| 1551 | 1551 |  				if ($objectname) { | 
                                                        
| 1552 | - $sql .= " AND objectname = '" . $this->db->escape($objectname) . "'";  | 
                                                        |
| 1552 | + $sql .= " AND objectname = '".$this->db->escape($objectname)."'";  | 
                                                        |
| 1553 | 1553 | }  | 
                                                        
| 1554 | 1554 |  				if ($methodename) { | 
                                                        
| 1555 | - $sql .= " AND methodename = '" . $this->db->escape($methodename) . "'";  | 
                                                        |
| 1555 | + $sql .= " AND methodename = '".$this->db->escape($methodename)."'";  | 
                                                        |
| 1556 | 1556 | }  | 
                                                        
| 1557 | 1557 |  				if ($command) { | 
                                                        
| 1558 | - $sql .= " AND command = '" . $this->db->escape($command) . "'";  | 
                                                        |
| 1558 | + $sql .= " AND command = '".$this->db->escape($command)."'";  | 
                                                        |
| 1559 | 1559 | }  | 
                                                        
| 1560 | 1560 |  				if ($params) { | 
                                                        
| 1561 | - $sql .= " AND params = '" . $this->db->escape($params) . "'";  | 
                                                        |
| 1561 | + $sql .= " AND params = '".$this->db->escape($params)."'";  | 
                                                        |
| 1562 | 1562 | }  | 
                                                        
| 1563 | - $sql .= " AND entity = " . ((int) $entity); // Must be exact entity  | 
                                                        |
| 1563 | + $sql .= " AND entity = ".((int) $entity); // Must be exact entity  | 
                                                        |
| 1564 | 1564 | |
| 1565 | 1565 | $result = $this->db->query($sql);  | 
                                                        
| 1566 | 1566 |  				if (!$result) { | 
                                                        
@@ -1886,9 +1886,9 @@ discard block  | 
                                                    ||
| 1886 | 1886 | |
| 1887 | 1887 | // If the module is active  | 
                                                        
| 1888 | 1888 |  				foreach ($this->rights as $key => $value) { | 
                                                        
| 1889 | - $r_id = $this->rights[$key][self::KEY_ID]; // permission id in llx_rights_def (not unique because primary key is couple id-entity)  | 
                                                        |
| 1889 | + $r_id = $this->rights[$key][self::KEY_ID]; // permission id in llx_rights_def (not unique because primary key is couple id-entity)  | 
                                                        |
| 1890 | 1890 | $r_label = $this->rights[$key][self::KEY_LABEL];  | 
                                                        
| 1891 | - $r_type = $this->rights[$key][self::KEY_TYPE] ?? 'w'; // TODO deprecated  | 
                                                        |
| 1891 | + $r_type = $this->rights[$key][self::KEY_TYPE] ?? 'w'; // TODO deprecated  | 
                                                        |
| 1892 | 1892 | $r_default = $this->rights[$key][self::KEY_DEFAULT] ?? 0;  | 
                                                        
| 1893 | 1893 | $r_perms = $this->rights[$key][self::KEY_FIRST_LEVEL] ?? '';  | 
                                                        
| 1894 | 1894 | $r_subperms = $this->rights[$key][self::KEY_SECOND_LEVEL] ?? '';  | 
                                                        
@@ -1912,7 +1912,7 @@ discard block  | 
                                                    ||
| 1912 | 1912 | }  | 
                                                        
| 1913 | 1913 | |
| 1914 | 1914 |  					// condition to show or hide a user right (default: 1) (eg isModEnabled('anothermodule') or ($conf->global->MAIN_FEATURES_LEVEL > 0) or etc..) | 
                                                        
| 1915 | - $r_enabled = $this->rights[$key][self::KEY_ENABLED] ?? '1';  | 
                                                        |
| 1915 | + $r_enabled = $this->rights[$key][self::KEY_ENABLED] ?? '1';  | 
                                                        |
| 1916 | 1916 | |
| 1917 | 1917 | // Search if perm already present  | 
                                                        
| 1918 | 1918 | $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."rights_def";  | 
                                                        
@@ -1929,7 +1929,7 @@ discard block  | 
                                                    ||
| 1929 | 1929 | $sql .= ", libelle";  | 
                                                        
| 1930 | 1930 | $sql .= ", module";  | 
                                                        
| 1931 | 1931 | $sql .= ", module_origin";  | 
                                                        
| 1932 | - $sql .= ", type"; // TODO deprecated  | 
                                                        |
| 1932 | + $sql .= ", type"; // TODO deprecated  | 
                                                        |
| 1933 | 1933 | $sql .= ", bydefault";  | 
                                                        
| 1934 | 1934 | $sql .= ", perms";  | 
                                                        
| 1935 | 1935 | $sql .= ", subperms";  | 
                                                        
@@ -1940,12 +1940,12 @@ discard block  | 
                                                    ||
| 1940 | 1940 | $sql .= ", '".$this->db->escape($r_label)."'";  | 
                                                        
| 1941 | 1941 | $sql .= ", '".$this->db->escape($r_module)."'";  | 
                                                        
| 1942 | 1942 | $sql .= ", '".$this->db->escape($r_module_origin)."'";  | 
                                                        
| 1943 | - $sql .= ", '".$this->db->escape($r_type)."'"; // TODO deprecated  | 
                                                        |
| 1943 | + $sql .= ", '".$this->db->escape($r_type)."'"; // TODO deprecated  | 
                                                        |
| 1944 | 1944 | $sql .= ", ".((int) $r_default);  | 
                                                        
| 1945 | 1945 | $sql .= ", '".$this->db->escape($r_perms)."'";  | 
                                                        
| 1946 | 1946 | $sql .= ", '".$this->db->escape($r_subperms)."'";  | 
                                                        
| 1947 | 1947 | $sql .= ", '".$this->db->escape($r_enabled)."'";  | 
                                                        
| 1948 | - $sql.= ")";  | 
                                                        |
| 1948 | + $sql .= ")";  | 
                                                        |
| 1949 | 1949 | |
| 1950 | 1950 | $resqlinsert = $this->db->query($sql, 1);  | 
                                                        
| 1951 | 1951 | |
@@ -2162,7 +2162,7 @@ discard block  | 
                                                    ||
| 2162 | 2162 | |
| 2163 | 2163 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";  | 
                                                        
| 2164 | 2164 | $sql .= " WHERE module = '".$this->db->escape($module)."'";  | 
                                                        
| 2165 | - $sql .= " AND menu_handler = 'all'"; // We delete only lines that were added manually or by the module activation. We keep entry added by menuhandler like 'auguria'  | 
                                                        |
| 2165 | + $sql .= " AND menu_handler = 'all'"; // We delete only lines that were added manually or by the module activation. We keep entry added by menuhandler like 'auguria'  | 
                                                        |
| 2166 | 2166 | $sql .= " AND entity IN (0, ".$conf->entity.")";  | 
                                                        
| 2167 | 2167 | |
| 2168 | 2168 | dol_syslog(get_class($this)."::delete_menus", LOG_DEBUG);  | 
                                                        
@@ -2546,36 +2546,36 @@ discard block  | 
                                                    ||
| 2546 | 2546 | }  | 
                                                        
| 2547 | 2547 | |
| 2548 | 2548 |  		if ($this->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) { | 
                                                        
| 2549 | -			$versionTitle =  $langs->trans("Version").' '.$this->getVersion(1); | 
                                                        |
| 2549 | +			$versionTitle = $langs->trans("Version").' '.$this->getVersion(1); | 
                                                        |
| 2550 | 2550 |  			if ($this->needUpdate) { | 
                                                        
| 2551 | 2551 |  				$versionTitle .= '<br>'.$langs->trans('ModuleUpdateAvailable').' : '.$this->lastVersion; | 
                                                        
| 2552 | 2552 | }  | 
                                                        
| 2553 | 2553 | |
| 2554 | - $return .= '<span class="info-box-icon-version'.($versiontrans ? ' '.$versiontrans : '').' classfortooltip" title="'.dol_escape_js($versionTitle).'" >';  | 
                                                        |
| 2555 | - $return .= $this->getVersion(1);  | 
                                                        |
| 2556 | - $return .= '</span>';  | 
                                                        |
| 2554 | + $return .= '<span class="info-box-icon-version'.($versiontrans ? ' '.$versiontrans : '').' classfortooltip" title="'.dol_escape_js($versionTitle).'" >';  | 
                                                        |
| 2555 | + $return .= $this->getVersion(1);  | 
                                                        |
| 2556 | + $return .= '</span>';  | 
                                                        |
| 2557 | 2557 | }  | 
                                                        
| 2558 | 2558 | |
| 2559 | - $return .= '</div>  | 
                                                        |
| 2559 | + $return .= '</div>  | 
                                                        |
| 2560 | 2560 | <div class="info-box-content info-box-text-module'.(!getDolGlobalString($const_name) ? '' : ' info-box-module-enabled'.($versiontrans ? ' info-box-content-warning' : '')).'">  | 
                                                        
| 2561 | 2561 | <span class="info-box-title">'.$this->getName().'</span>  | 
                                                        
| 2562 | 2562 | <span class="info-box-desc twolinesmax opacitymedium" title="'.dol_escape_htmltag($this->getDesc()).'">'.nl2br($this->getDesc()).'</span>';  | 
                                                        
| 2563 | 2563 | |
| 2564 | - $return .= '<div class="valignmiddle inline-block info-box-more">';  | 
                                                        |
| 2564 | + $return .= '<div class="valignmiddle inline-block info-box-more">';  | 
                                                        |
| 2565 | 2565 |  		//if ($versiontrans) print img_warning($langs->trans("Version").' '.$this->getVersion(1)).' '; | 
                                                        
| 2566 | -		$return .=  '<a class="valignmiddle inline-block" href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.((int) $this->numero).'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto(($this->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule").' - ' : '').$langs->trans("ClickToShowDescription"), $imginfo).'</a>'; | 
                                                        |
| 2567 | - $return .= '</div><br>';  | 
                                                        |
| 2568 | -  | 
                                                        |
| 2569 | - $return .= '<div class="valignmiddle inline-block info-box-actions">';  | 
                                                        |
| 2570 | - $return .= '<div class="valignmiddle inline-block info-box-setup">';  | 
                                                        |
| 2571 | - $return .= $codetoconfig;  | 
                                                        |
| 2572 | - $return .= '</div>';  | 
                                                        |
| 2573 | - $return .= '<div class="valignmiddle inline-block marginleftonly marginrightonly">';  | 
                                                        |
| 2574 | - $return .= $codeenabledisable;  | 
                                                        |
| 2575 | - $return .= '</div>';  | 
                                                        |
| 2576 | - $return .= '</div>';  | 
                                                        |
| 2577 | -  | 
                                                        |
| 2578 | - $return .= '  | 
                                                        |
| 2566 | +		$return .= '<a class="valignmiddle inline-block" href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.((int) $this->numero).'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto(($this->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule").' - ' : '').$langs->trans("ClickToShowDescription"), $imginfo).'</a>'; | 
                                                        |
| 2567 | + $return .= '</div><br>';  | 
                                                        |
| 2568 | +  | 
                                                        |
| 2569 | + $return .= '<div class="valignmiddle inline-block info-box-actions">';  | 
                                                        |
| 2570 | + $return .= '<div class="valignmiddle inline-block info-box-setup">';  | 
                                                        |
| 2571 | + $return .= $codetoconfig;  | 
                                                        |
| 2572 | + $return .= '</div>';  | 
                                                        |
| 2573 | + $return .= '<div class="valignmiddle inline-block marginleftonly marginrightonly">';  | 
                                                        |
| 2574 | + $return .= $codeenabledisable;  | 
                                                        |
| 2575 | + $return .= '</div>';  | 
                                                        |
| 2576 | + $return .= '</div>';  | 
                                                        |
| 2577 | +  | 
                                                        |
| 2578 | + $return .= '  | 
                                                        |
| 2579 | 2579 | </div><!-- /.info-box-content -->  | 
                                                        
| 2580 | 2580 | </div><!-- /.info-box -->  | 
                                                        
| 2581 | 2581 | </div>';  | 
                                                        
@@ -2595,7 +2595,7 @@ discard block  | 
                                                    ||
| 2595 | 2595 |  	{ | 
                                                        
| 2596 | 2596 | require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';  | 
                                                        
| 2597 | 2597 |  		if (!empty($this->url_last_version)) { | 
                                                        
| 2598 | -			$lastVersion = getURLContent($this->url_last_version, 'GET', '', 1, array(), array('http', 'https'), 0);	// Accept http or https links on external remote server only | 
                                                        |
| 2598 | +			$lastVersion = getURLContent($this->url_last_version, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only | 
                                                        |
| 2599 | 2599 |  			if (isset($lastVersion['content']) && strlen($lastVersion['content']) < 30) { | 
                                                        
| 2600 | 2600 | // Security warning : be careful with remote data content, the module editor could be hacked (or evil) so limit to a-z A-Z 0-9 _ . -  | 
                                                        
| 2601 | 2601 |  				$this->lastVersion = preg_replace("/[^a-zA-Z0-9_\.\-]+/", "", $lastVersion['content']); |